Skip to content

Docker Cli Commands

Show all Containers

docker ps -a

Update All Downloaded Images

docker images |grep -v REPOSITORY|awk '{print $1}'|xargs -L1 docker pull

Find Container IP

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id

Container Specific Logs (to view the output of commands running in container)

docker logs mysqldb

View Details for Specific Docker

docker inspect mysqldb_map

Rename a Container

docker rename CONTAINER NEW_NAME

Copy Files Into Docker Container

docker cp 1.txt mycontainer:/1.txt

Run Docker to Map Port 9000 to Forward 3306

docker run -d -p 3306:9000 dockercloud/mysql

Allow Outbound Forwarding for the Container to the World

on the host server run the following command:

sysctl net.ipv4.conf.all.forwarding=1
iptables -P FORWARD ACCEPT

Last update: September 3, 2021
Back to top