Skip to content

Instantly share code, notes, and snippets.

@jjb
Last active Feb 7, 2022
Embed
What would you like to do?
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