Building Docker Images over remote repositories Artifactory

1.2k Views Asked by At

I use Artifactory as remote repository to build my docker image. Now befor I execute the command $ docker build I have to change the docker file so that each line should be changed.

FROM rocker/shiny
RUN apt-get update
RUN apt-get update && apt-get install -y
.
.
. 

There are roughly 100 lines in the docker file. In order to say that docker build should run over Artifactory I have to change every line like as follows:

FROM docker-remote-docker-io.artifacts/rocker/shiny

Is there any possibility to set docker or change . ~/.profile to avoid the changeing every line in the docher file?

The option URL in docker build is not what I need! ;)

1

There are 1 best solutions below

2
On

You don't say where you are building but you can setup a proxy to dockerhub

Luckly there is a feature on Docker Engine that goes mostly unnoticed: the “--registry-mirror” daemon option. Engine options are configured somewhat differently on each Linux distro, but in CentOS/RHEL you can do it editing the “/etc/sysconfig/docker” file and restarting Docker:

This way you don't have to change your FROM lines