Skip to content

Instantly share code, notes, and snippets.

@jkullick
Created December 22, 2016 08:35
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jkullick/9c69f97edf295b6e964318fd8852570a to your computer and use it in GitHub Desktop.
Save jkullick/9c69f97edf295b6e964318fd8852570a to your computer and use it in GitHub Desktop.
Build Docker Image without Dockerfile
docker build -t $IMAGE_NAME - << EOF
FROM alpine:latest
...
EXPOSE 80
EOF
@pascal-hofmann
Copy link

pascal-hofmann commented Nov 27, 2019

Note that the docker build context in this case only contains the Dockerfile from STDIN. So it's not possible to COPY/ADD files from the current working directory to the image.

If you need files from the current working directory use this instead:

docker build -t $IMAGE_NAME -f - . << EOF
FROM alpine:latest
...
COPY . /
EOF

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