Home Useful Docker commands
Post
Cancel

Useful Docker commands

Docker Version

1
docker -v

List Docker images

1
docker image list

Download an image

1
docker pull nginx:1.13.8

Remove docker image

1
docker rmi {image id}

Run an image and then interact with the command line

1
docker run -it nginx:1.13.8 /bin/bash

Execute commands within an already running container

1
docker exec -it containername /bin/bash

List containers running

1
docker container list

List containers running or stopped

1
docker container list -a

Stop a container

1
docker stop {container id}

Remove a container

1
docker rm {container id}

Copy files into a container

1
2
docker cp /tmp/config.ini grafana:/usr/share/grafana/conf/
docker cp /tmp/config.ini 1477326feb62:/usr/share/grafana/conf/
This post is licensed under CC BY 4.0 by the author.