XeNote/posts/Code/Linux/Docker Commands.md
2020-12-01 06:28:42 +03:00

743 B

Useful docker commands.

(source:AmortizedCost)


Check all running containers

docker ps -a

Check created networks

docker network ps

Show all images

docker images

Login into a container as a root user

docker exec -u 0 -it CONTAINER_ID /bin/bash

Execute a command on a container without logging in

docker exec -it CONTAINER_ID cat /etc/krb5.conf  

Copy a file to/from a container

The code below will copy hosts file from a container into a current directory on your local machine

docker cp CONTAINER_ID:/etc/hosts hosts