Last active
November 16, 2018 01:25
-
-
Save pak11273/2ed637f53aa92c7faceba83adece3d62 to your computer and use it in GitHub Desktop.
Docker setup & debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic Setup | |
// Create a Dockerfile and .dockerignore in root directory | |
// Run any npm scripts required (ie. babel build scripts) | |
// Build the container (don't forget the period at the end) | |
docker build -t <username>/<app name> . | |
ie. docker build -t pak11273/example:1.0.0 . | |
// TROUBLESHOOTING | |
// Run an image | |
sudo docker run -p <desired port>:<EXPOSE port> --net="host" -d <container> | |
ie. sudo docker run -p 3001:3010 --net="host" -d pak11273/example:1.0.0 | |
// If you have permission denied, after running this command relog into your terminal. | |
sudo usermod -a -G docker <username> | |
ie. sudo usermod -a -G docker vagrant | |
// If you docker image doesn't run you can log into your docker image with: | |
sudo docker commit <commit hash> broken-container && docker run -it broken-container /bin/bash | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment