Skip to content

Instantly share code, notes, and snippets.

@crosshj
Last active May 14, 2016 17:45
Show Gist options
  • Select an option

  • Save crosshj/733496d5118377d550c336e17deaab55 to your computer and use it in GitHub Desktop.

Select an option

Save crosshj/733496d5118377d550c336e17deaab55 to your computer and use it in GitHub Desktop.
https://docs.docker.com/engine/installation/windows/
Some notes here could also apply to Mac since Mac has to do a similar thing as far as I am aware.
#CREATE
docker-machine create -d virtualbox --virtualbox-disk-size "40000" dev
#MAKE ACTIVE
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env dev)
------------------
# stop and remove image
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
#get IP of machine
docker-machine ip dev
------------------
#https://github.com/docker/machine/issues/673
#I fixed a similar issue by doing
```
docker-machine env
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)
```
# intial tests
docker run hello-world
AND
docker run -it ubuntu bash
# next steps
touch docker_first
#then add some dockerfile stuff
#like https://seanmcgary.com/posts/deploying-a-nodejs-application-using-docker
#for example, to build image
docker build -t docker_first -f ./docker_first .
# to view images
docker images
#run one of those images (followed by a bash prompt)
docker run -i -t docker_first /bin/bash # for example, to run
# add -p 8080:8080 to map container port to host port (the VM's port)
#IP ISSUES
http://192.168.99.100:8080/ instead of localhost:8080
#this is because we have to access ip of VM, not of computer
#get IP of machine
docker-machine ip default << name of VM
#summary
docker build -t docker_first -f ./docker_first . #TO BUILD
docker run -p 8080:8080 -i -t docker_first #TO RUN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment