How to build docker image from github repository

后端 未结 3 1329
囚心锁ツ
囚心锁ツ 2021-01-31 08:24

In official docs we can see:

# docker build github.com/creack/docker-firefox

It just works fine to me. docker-firefox is a reposit

相关标签:
3条回答
  • 2021-01-31 09:00

    docker build url#ref:dir

    Git URLs accept context configuration in their fragment section, separated by a colon :. The first part represents the reference that Git will check out, this can be either a branch, a tag, or a commit SHA. The second part represents a subdirectory inside the repository that will be used as a build context.

    For example, run this command to use a directory called docker in the branch container:

    docker build https://github.com/docker/rootfs.git#container:docker
    

    https://docs.docker.com/engine/reference/commandline/build/

    0 讨论(0)
  • 2021-01-31 09:12

    One can use the following example which sets up a Centos 7 container for testing ORC file format. Make sure to escape the # sign:

    $ docker build https://github.com/apache/orc.git\#:docker/centos7 -t orc-centos7

    0 讨论(0)
  • 2021-01-31 09:22

    The thing you specified as repo URL is not a valid git repository. You will get error when you will try

    git clone github.com/docker-library/redis/tree/99c172e82ed81af441e13dd48dda2729e19493bc/2.8.10

    Valid URL for this repo is github.com/docker-library/redis. So you may want to try following:

    docker build github.com/docker-library/redis

    But this will not work too. To build from github, docker requires Dockerfile in repository root, howerer, this repo doesn't provide this one. So, I suggest, you only have to clone this repo and build image using local Dockerfile.

    0 讨论(0)
提交回复
热议问题