Docker Essentials | Docker Basics | Docker CLI Explained
Docker commands, Help and usage
how to Launch and run a docker container
How to Check the status of all docker containers.
How to log in and manage running container
How to Copy files from docker containers and vice versa
How to Start and stop the docker container
How to Remove Containers are stopped state
How to Check logs for troubleshooting the docker containers
How to check the usage and performance of docker containers
##Update
Sudo apt-get update && sudo apt-get upgrade
First check docker available or not
Install Docker
Sudo apt-get install docker.io
Curl –fsSL https://get.docker.com |sh
Check Docker version
Docker –v
sudo docker -version
Check docker running
Sudo systemctl status docker
Docker info
Docker help
Docker Common commands
Management Commands
Swarm Commands:
Commands:
Global Options:
List the docker volume
Sudo docker volume ls
Manage volumes commands
Manage image help
## Check docker info
sudo docker info
## Docker system command
##Check docker system usage
sudo docker system df
##Check Docker system events
sudo docker system events
Check docker systeminfo
sudo docker system info
Remove container
sudo docker system prune
Check states
sudo docker stats
Search docker images
sudo docker search buasapp
Search httpd docker images
sudo docker search httpd
Check with browser httpd
Check docker images
sudo docker images
Pull docker image
Sudo docker pull httpd
Sudo docker pull alpine
Check docker images
Sudo docker images
Check system df
sudo docker system df
Check how many containers running present
sudo docker ps
Run a container
sudo docker run –d --name web1 httpd
View the running container
sudo docker ps
View all the container running and stopped container
Sudo docker ps –a
Create a new container
Sudo docker run –a –name web2 httpd
To log in a container
sudo docker exec –it web2 /bin/sh
-it is interactive and terminal
Exit a container
Ctrl+D
Run a command without login container
Sudo docker exec web2 /bin/sh
Sudo docker exec web2 uname –a
Create a directory
sudo docker exec web2 mkdir /tmp/selva
view the file name
Sudo docker exec web2 ls /tmp/
login the container checks whether the file was created or not
Sudo docker exec –it web2 /bin/bash
cd /tmp
ls –lrt
How to copy a file to the container
Create test directory in local then copy to the container
sudo docker cp test/ 3e2aa7766bb1:/tmp
sudo docker exec web2 ls /tmp; Now see test file copied
File copied from a container
Sudo docker cp web2:/tmp/test .
to stop a container
sudo docker stop web2
start a container
sudo docker start web2
Check system df
sudo docker system df
Check system states
sudo docker system stats
View specific container stats
sudo docker stats web2
Check system events
sudo docker system events
##Remove a container
Sudo docker stop web1
Sudo docker rm web1
To list a container
sudo docker ps –a
run a container
sudo docker run –d –name web2 httpd
Check container logs
Sudo docker logs web2
run an os like Ubuntu
Sudo docker run -d -it –name dummy3 alpine /bin/sh/
check progress
Sudo docker top web2
Delete a container
Sudo docker system prune
Docker Images V3
List docker images
Pull the image
Pull the image for particular tag
Run a container
Port forwading 81
It works
See the port forwading
Port 82
View complete information about docker image
Backup a image locally
Stop a container
Remove a container
Remove a image
To remove a multiple images
How to create image using container
Load a image
Run a image
Login a container
Create a directory selva
Create a dummy file
Update
Install n map
Install Curl
Exit
Commit a container
View the images
Add a Tag for container
Now see tag assigned
Run a image
List a container
Login a container
Exit a container
Now see both created file show selva,dummy
Exit
Push a Image
Docker login
Login success
List a images
Rename a tag as your dockerhub login
Rename done
Push
Image received