Gitea and jenkins docker containers not communicating

  docker, docker-compose, gitea, jenkins

I am trying to setup a flow where I check out code from gitea, build it on jenkins and push the artifact on nexus. All services, gitea, nexus and jenkins are started in containers. I have the following docker-compose.yaml file:

version: "3"
networks:
container-network: {}

services:
server: 
    image: gitea/gitea:1.13.1
    container_name: gitea
    networks:
        - container-network
    ports: 
       - "3000:3000"
       - "222:22"
    restart: always
    volumes:
        - ./gitea:/data
        - /etc/timezone:/etc/timezone:ro
        - /etc/localtime:/etc/localtime:ro
    environment:
        - USER_UID=1000
        - USER_GID=1000    
jenkins:
    image: jenkins/jenkins:lts
    networks:
        - container-network
    privileged: true
    user: root
    ports:
        - 8080:8080
        - 50000:50000
    container_name: jenkins
    volumes:
        - ./jenkins_data:/var/jenkins_home
        - /var/run/docker.sock:/var/run/docker.sock
nexus:
    image: sonatype/nexus3
    networks:
        - container-network
    user: root
    ports:
        - "8081:8081"      
    container_name: nexus
    volumes: 
        - ./nexus_data:/nexus_data
       

After starting the containers with docker-compose up -d, they are all working good separately. But, when I try to create a Jenkins job to pull out from my gitea repo, I receive the following error:
enter image description here

Seems like the containers don’t communicate between themselves. I checked the networks in docker client and these two seem to be on the same network, but the nexus container is missing:
enter image description here

I managed to push code from my IDE to the gitea repo. Can someone explain me what is wrong here?

Source: Docker Questions

LEAVE A COMMENT