Skip to content

Instantly share code, notes, and snippets.

@hamiltondanielb
Created August 17, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamiltondanielb/9b7b265454c55cb7a14c to your computer and use it in GitHub Desktop.
Save hamiltondanielb/9b7b265454c55cb7a14c to your computer and use it in GitHub Desktop.
Docker Information
#### Run within Docker
For now we have to build the docker image locally. Late I will get it hosted
###### Building your image
Go to the directory that has your Dockerfile and run the following command to build a Docker image. The -t flag lets you tag your image so it’s easier to find later using the docker images command:
`docker build -t hamiltondanielb/record-web-react .`
Your image will now be listed by Docker:
`docker images`
###### Example
```
REPOSITORY TAG ID CREATED
centos centos6 539c0211cd76 8 weeks ago
hamiltondanielb/record-web-react latest d64d3505b0d2 2 hours
```
###### Run the image
Running your image with -d runs the container in detached mode, leaving the container running in the background. The -p flag redirects a public port to a private port in the container. Run the image you previously built:
`docker run -p 49160:8080 -d hamiltondanielb/record-web-react`
Print the output of your app:
###### Get container ID
`docker ps`
###### Print app output
`docker logs <container id>`
###### Update hub
`docker commit <container id> hamiltondanielb/record-web-react:master`
`docker push`
###### Example
`Running on http://localhost:8080`
###### Boot2docker
If you use Boot2docker on OS X, the port is actually mapped to the Docker host VM, and you should use the following command to get the ip of your boot2docker vm:
`$(boot2docker ip)`
Then using the ip that is outputted from that command you can visit
`http://boot2dockerip:49160`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment