Docker Community Forums

Share and learn in the Docker community.

Check building on hub.docker.com or local machine, and execute corresponding code

build
dockerhub

(Eromoe) #1

Hi,

I am in China, I need create a docker image with custom apt-get source ,pip source and so on.? (Because of GFW in China, default source is usually unreachable or very very slow )

I write a Dockfile here https://github.com/eromoe/base/blob/master/Dockerfile

Local building is fine, but can not build on hub.docker.com for a long time, detail https://hub.docker.com/r/eromoe/base/builds/blen9qjpkxogo2bac5qq2nu/
Looks like some network error.

I only want to use one Dockerfile to support Local building and dockerhub host. So is there any way to check if building in hub.docker.com or local and execute corresponding code? Such as, when build in hub.docker.com, update source at last .


(Sam) #2

write a shell script that can figure out the host issuing the build request and do the extra work when required