Skip to content

Instantly share code, notes, and snippets.

@pak11273
Last active November 16, 2018 01:25
Show Gist options
  • Save pak11273/2ed637f53aa92c7faceba83adece3d62 to your computer and use it in GitHub Desktop.
Save pak11273/2ed637f53aa92c7faceba83adece3d62 to your computer and use it in GitHub Desktop.
Docker setup & debugging
// 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