Home > Mobile >  Docker Build a GitHub Repository and Push to DockerHub
Docker Build a GitHub Repository and Push to DockerHub

Time:01-20

I've got a GitHub repo which has a Dockerfile in the project root. I want to build the repository, but am experiencing errors.

Command run (The Dockerfile is located in the repository root, in the main branch)

$ docker build https://github.com/$RepoOwner/$RepositoryName.git#main:.
$ docker build https://github.com/$RepoOwner/$RepositoryName.git#main:

Both yield the following error:

unable to prepare context: unable to 'git clone' to temporary context directory: error initializing submodules: usage: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] deinit [-f|--force] [--] <path>...
   or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
: exit status 1

CodePudding user response:

I resolved this by cloning the Git repository and then running docker build on it.

  •  Tags:  
  • Related