Skip to content

Instantly share code, notes, and snippets.

@shanereddy
Last active February 27, 2018 13:39
Show Gist options
  • Save shanereddy/5d584199f923eeb6d9f6c3b2263867f3 to your computer and use it in GitHub Desktop.
Save shanereddy/5d584199f923eeb6d9f6c3b2263867f3 to your computer and use it in GitHub Desktop.
Docker cheatsheet

Docker commands cheatsheet

Creating an image

From current dir with Dockerfile

docker build -t <tag-name> .

Using no cache

docker build -t <tag-name> . --no-cache

Running a container

With env vars

docker run -d -p 6262:6262 -e "LOG_LEVEL=error" -e "NODE_ENV=production" -t <tag-name>

With a given name

docker run -d -p 6262:6262 --name <container-name> -t <tag-name>

Useful Tips

Access host machine from container

On osx: use docker.for.mac.host.internal to access the host machine from the running container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment