mhgolestan / docker-training

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-training

Docker cheat sheet

Working with Docker Images :

docker image ls
docker image inspect hello-world

use jq for better inspection:
The environment variables:
docker image inspect hello-world | jq '.[].Config.Env'
startup command on the container:
docker image inspect hello-world | jq '.[].Config.Cmd'
Layers associated with the image
docker image inspect hello-world | jq '.[].RootFS.Layers'

Another example with nginx

docker pull nginx:stable
docker run -p 80:80 nginx
The first parameter after the flag is the port on the Docker host which must be published, and the second parameter refers to the port within the container. You can confirm that the image publishes the port using docker inspect: docker image inspect nginx | jq '.[].Config.ExposedPorts'


or we can change the port on which the service is published on the Docker host by changing the first parameter after the -p flag, as follows: docker run -p 8080:80 nginx
curl http://localhost:8080

About


Languages

Language:Python 91.0%Language:HTML 5.6%Language:Dockerfile 3.4%