Docker playground: https://labs.play-with-docker.com/
tag coud be enything, it should help to identify application and its version, e.g.
# Build image, can use multiple tags
docker build . -t ${tag1} -t ${tag2} ${buildArgs}
# Push to repo
docker push gcr.io/my-proj/my-app:latest gcr.io/my-proj/my-app:1.0.5
- List all running images:
docker ps
- Run container
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.6.0
to run in background, detached -- use -d
option, e.g.
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.6.0
- SSH into a running container
docker ps
docker exec -it {{container id}} /bin/bash
- Run bash on image
docker images
docker run -it --entrypoint /bin/bash {{image id}}
- Get logs from running container
sudo docker logs 4bedab917a00
follow log changes
sudo docker logs -f 4bedab917a00
# List apps
gcloud container images list --repository gcr.io/my-proj
# List app versions
gcloud container images list-tags gcr.io/my-proj/my-app
- Problem: Docker is running, but gives
Cannot connect to the Docker daemon
on any command, e.g.
$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Solution: try to run same command with sudo
, e.g. sudo docker os