During the build phase you may need to access dependencies in private (or, generally non-public) repositories.
This solution configures Git to use HTTPS with login and access token for the repository with URL <repo-url>
.
- Create an access token (see 1)
- Add the following lines to your Dockerfile
ARG LOGIN ARG TOKEN # Configure Git to use HTTPS with access token for git.maibornwolff.de; retrieve dependencies RUN git config --global url."https://${LOGIN}:${TOKEN}@<repo-url>/".insteadOf "https://<repo-url>/"
- Run
docker build
with arguments--build-arg <login> --build-arg <token>
docker build -t <tag> --build-arg <login> --build-arg <token> <dockerfile>