Last active
May 21, 2018 15:10
-
-
Save abhi11210646/a9ab7342bca16c2b9f4d0f52349581dd to your computer and use it in GitHub Desktop.
Docker basic commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Running docker container nginix images(new container) | |
> docker container run --publish 80:80 --detach nginix // --detach(-d) to run in background // --publish(-p) defines port forwarding | |
> docker container run --publish HOST_PORT:CONTAINER_PORT --detach --name nginx_server nginix // --name to provide unique name to container | |
#List docker container | |
> docker container ls -a // -a to list all running or stopped containers | |
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | |
CONTAINER ID CREATED IMAGE STATUS COMMAND PORTS NAMES | |
720967e55bcf nginx Up 6 minutes "nginx -g ' 0.0.0.0:81->80/tcp amazing_jones | |
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | |
#Stop docker container | |
> docker container stop 720 // 720 is the first few digits of container ID and are capable enough to identify container. | |
#Start docker container | |
> docker container start 720 // start to start stopped container | |
#Check logs of container using container name or contaoner ID | |
> docker container logs 720 | |
#Running process inside container | |
> docker container top amazing_jones | |
#Container configuration | |
> docker container inspect amazing_jones | |
#Container live performance stats | |
> docker container stats // by defailt all containers stats | |
#Removing containers | |
> docker container rm 720 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment