On my Jenkins server (deployed with the official jenkins image), I need to run the following code to build my docker image
def buildDockerImage() {
sh "docker build --network=host -t $DOCKER_REPO ."
}
Note the --network=host
option.
Now my problem is that on my development laptop, I don't need that option to build my image. Why is that? Why don't I need that on my laptop but I need it on the jenkins server? The Jenkins server is hosted on a Jelastic environment, like this:
env:
topology:
nodes:
- image: jenkins/jenkins:lts
count: 1
cloudlets: 32
nodeGroup: cp
Docker is installed like this:
mv /etc/init.d/kmod /etc/init.d/kmod.back
apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt -y install docker-ce docker-ce-cli containerd.io
service docker start
usermod -aG docker jenkins
Is there something I need to configure to make it happen without that network option?