Published on

Build Docker Container from a Git URL


I normally use excellent MermaidJS to create technical diagrams. To do this I generally go to Mermaid's page to use the live editor. But Github pages is down :'(. To try to get around this I went to the live editors git repo where I saw I can build and run this as a docker image.

What is interesting is the docker build command points to the repo's git URL:

docker build -t mermaidjs/mermaid-live-editor

This is cool and something I did not know docker could do. The description for this can be found on the official documentation"

The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.

The URL parameter can refer to three kinds of resources: Git repositories, pre-packaged tarball contexts and plain text files.