z2015 Docker cheat sheet - SoCraTesUK/socrates-uk GitHub Wiki
IF YOU ARE HAVING TROUBLE WITH BOOT2DOCKER, YOU MAY WANT TO EXPORT YOUR DOCKER ENVIRONMENT VARIABLES:
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/<YOURUSERNAME>/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
Boot2Docker HOST:
192.168.59.103
View running images:
$ docker images
View running docker container:
$ docker ps -a
Kill a docker container:
$ docker kill <containerId>
Remove a inactive docker container
$ docker rm <containerId>
Run a docker image inside an interactive shell:
$ docker run --rm -i -t -p <port>:<port> <imageId> sh
TO ASSIGN ALL EXPOSED PORTS TO A RANDOM PORT, USE THE UPPER CASE P ARGUMENT ALONE:
-P
Run a docker image in detached mode
$ docker run -d <imageId>
Query for the port that a running container is exposed on:
$ docker port <imageName/ImageId>
Build a docker file:
$ docker build <directoryOfYourDockerFile> --tag=<YourTagName>
View docker logs:
$ docker logs
Tag a docker image:
$ docker tag <imageName> zero2continuousdeployment/<yourServiceName>
Push a docker image:
$ docker push zero2continuousdeployment/<yourServiceName>
User: zero2continuousdeployment
Pass: zero2continuousdeployment
View the docker hub:
https://hub.docker.com/u/zero2continuousdeployment/
Pull your docker image
unset DOCKER_TLS_VERIFY
docker -H tcp://services.samirtalwar.com:2375 pull zero2continuousdeployment/<YourServiceName>
View remote docker images
docker -H tcp://services.samirtalwar.com:2375 images