Windows 10 with Anniversary update
Using Docker Toolbox (uses boot2docker VirtualBox machines)
docker -v
Docker version 1.12.0, build 8eab29e
-
docker-machine create --driver virtualbox some-box
ordocker-machine start some-box
if you already created the machine -
docker-machine env some-box
(be sure the run the command it spits out at the end of that output to actual setup your env -
Setup the nginx container
docker run -d -v //c/Users/MLM/Downloads/static-server-stuff/public:/usr/share/nginx/html:ro -v //c/Users/MLM/Downloads/static-server-stuff/nginx.conf:/etc/nginx/nginx.conf:ro -p 5031:80 --name some-nginx nginx
-d
: "Run container in background and print container ID", https://docs.docker.com/engine/reference/commandline/run/#options-v //c/Users/MLM/Downloads/static-server-stuff/public:/usr/share/nginx/html:ro
: Sets up a shared read-only(:ro
) volume mapping your Windows host directory,C:\Users\MLM\Downloads\static-server-stuff\public
, to/usr/share/nginx/html
in the container-v //c/Users/MLM/Downloads/static-server-stuff/nginx.conf:/etc/nginx/nginx.conf:ro
: Sets up a shared read-only(:ro
) volume mapping your Windows host file,C:\Users\MLM\Downloads\static-server-stuff\nginx.conf
, to/etc/nginx/nginx.conf
in the container-p 5031:80
: Maps port Docker machines port5031
to the containers port80
(accessible ondocker-machine ip some-box
, notlocalhost
)--name some-nginx
: Adds a name to your container so you can better distinguish it (it can be anything)nginx
: The image name to use
-
Run
docker-machine ip some-box
to get the IP we can access -
Visit the IP we just got above with the port we specified on the container, perhaps something like
http://192.168.99.100:5031
docker ps --all
will show you all of the containers in the machine- You can stop a container by using the ID from the command above,
docker stop e4926128afab
- You can remove a container by using the ID from the command above
docker rm e4926128afab
docker-machine ls
will show you all of the machines- To stop the Docker machine
docker-machine stop some-box
- To remove the whole Docker machine
docker-machine rm -f some-box
If you want to delete/remove the containers/machines, see the Teardown
section above.
You can look at the logs of a container
# You can use the container anme
docker logs some-nginx
# Or use the container ID
docker logs 19d1cdda14a6
You can essentially SSH into the container by using the following command (use your own container ID, docker ps --all
)
docker exec -it 19d1cdda14a6 bash