Basic Docker Commands
Today i will show you some docker commands that will help in using docker. These are basic docker commands that will help in daily work with docker lets get started with the commands
- List of all images of docker
$ docker images
- List of all running containers
$ docker ps
- List of all running and stopped containers
$ docker ps -a
- Pull a docker image
$ docker pull centos
- Run a docker Container
$ docker run -i -t centos /bin/bash
- Execute a command in running container
$ docker exec -i -t (container id) /bin/bash
- Stop a docker container
$ docker stop (container id)
- Delete a docker container
$ docker rm (container id)
- Delete docker images
(Prerequisite: You have to delete all conatiners related to docker image to delete the image or you can force deleting the docker images by using -f option in the following command)
$ docker rmi centos
- Run a docker container in background
$ docker run -d -t centos /bin/bash
- Attach a running container
$ docker attach (container id)
- Docker help (most useful command)
$ docker --help
By using these commands you can use docker easily.
See also: How to use Docker
Support Install Virtual