Skip to content

Instantly share code, notes, and snippets.

@jjb
Last active February 7, 2022 07:04
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 jjb/3df3828bb9da9636771bf9efac565544 to your computer and use it in GitHub Desktop.
Save jjb/3df3828bb9da9636771bf9efac565544 to your computer and use it in GitHub Desktop.
How to build a Dockerfile and open a shell in it
# "foo" is not a placeholder, it's a name that needs to be given
# this exact command will work if a Dockerfile is present
docker build -t foo . && docker run -it foo
# if you want to force creation of an amd64 image when on an M1/arm64 Mac
docker build --platform linux/amd64 -t foo . && docker run -it foo
# if your container doesn't have a shell as an entrypoint
# e.g. node:@latest
docker build --platform linux/amd64 -t foo . && docker run -it --entrypoint bash foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment