Notes about docker and commands commonly used. Putting together an easy to follow reference guide.
- https://docs.docker.com/docker-for-mac/
- https://docs.docker.com/toolbox/toolbox_install_mac/
- https://download.docker.com/mac/stable/DockerToolbox.pkg
Check the version:
docker -v
docker pull kitematic/hello-world-nginx
Create and run
docker run kitematic/hello-world-nginx
Port binding/forwarding
docker run -p 80:80 kitematic/hello-world-nginx
docker run -d -p 80:80 --name helloworld kitematic/hello-world-nginx
Note: -d
is in detached mode
453411b0f57c
docker ps
docker ps -a #shows running & non-active containers
docker stop <container-id>
docker stop <container-name>
docker exec -it <container> /bin/bash
Note: the container must have /bin/bash installed.
E.g. You can try on this image https://hub.docker.com/_/ruby/