Docker Commands Flashcards
What is tag in docker image ?
While pulling the docker image , version of image is tag
like **redis:4.0 ** is a tag
WhaT is the default tag ?
latest version is default tag
Where we know the tags of images ?
In docker hub we see the image tags
What is a command to run a docker
docker run dockerImage
How to view running containers
docker ps
How to view stoped containers
docker ps -a
How to stop docker
docker stop dockerName/dockerID
How to view downloaded images
docker images
How to delete stored images ?
docker rmi imageID/RepoName
How to download only docker image
docker pull imageName
How to run a docker in detached mode
docker -d dockerImage
How to attach a detached docker ?
docker attach dockerName/ID
How to check docker version ?
docker version
How to view docker network connections
docker network ls
What are tags in docker ?
Image versions are docker tags
How to download docker image by tag
Image name followed by : colon
docker pull redis:7.2.3-alpine3.18
or
docker pull redis:latest
How to mount a host directory in docker container
docker run -v /opt/dataDir:/var/lib/mysql mysql
How to run a docker with name
docker run –name thor centos
How to check logs of running container ?
docker logs container-name
Run docker from busybox image , auto remove after stop , autologin & detached , also name a container .
docker run –name thor –rm -itd busybox
How to get os relese info of docker ?
docker run ubuntu cat /etc/rel
How to run docker container for 2 minutes
docker run ubuntu sleep 120
How to pull the latest tag of ubuntu version
docker run ubuntu:latest
How Map a host port to docker container port
docker run -p 4000:8080 kodekloud/webapp