Docker Stack: DevOps

  • This is a docker stack of the following docker images:

  • First install the cifs-utils package (your system may already have this installed):

    sudo dnf install cifs-utils
  • Create a docker-devops-stack directory. The rest of the document will reference this directory.

  • All data for these docker services will be stored here so be mindful of space constraints.

    This directory can be created in your home directory or any other directory that can grow to a few GBs in size.

  • Create various directories for the docker containers:

    1. Change directory to the root of where you want to store the docker data files.

      cd /home/mattosd
    2. Make folder for docker data.

      mkdir -p docker-devops-stack

      In this example the docker project directory will be /home/mattosd/docker-devops-stack

  • Update folder permissions:

    chmod 777 -R docker-devops-stack
  • Use a docker-compose file to start all services.

    1. Within the docker-devops-stack folder, create a docker-compose.yml file with the following contents:

      version: '3.7'
      services:
        jenkins:
          image: jenkins/jenkins:lts
          container_name: My-Jenkins
          privileged: true
          user: root
          ports:
            - 8081:8080
            - 50000:50000
          volumes:
            - ./jenkins:/var/jenkins_home
            - /var/run/docker.sock:/var/run/docker.sock
            - /usr/local/bin/docker:/usr/local/bin/docker
      
        # https://www.howtogeek.com/devops/how-to-deploy-a-gitlab-server-with-docker/
        gitlab:
          image: 'gitlab/gitlab-ce:latest'
          container_name: My-GitLab
          restart: always
          hostname: sourcecontrol.xackleystudio.com
          ports:
            - '2224:22'
            - '8929:80'
            - '8443:443'
          environment:
            - TZ=America/New_York
          volumes:
            - ./GitLab/config:/etc/gitlab'
            - ./GitLab/logs:/var/log/gitlab'
            - ./GitLab/data:/var/opt/gitlab'
          shm_size: '256m'
    2. Start the containers:

      cd docker-devops-stack
      sudo docker-compose up -d
      The initial build of Gitlab will take a long while to start.
  • Open FW ports

    1. Jenkins: 8081:

  • Navigate to the container web pages:

    1. Jenkins

      1. Browse here

        http://localhost:8081
      2. Retrieve the initial password via:

        sudo docker exec My-Jenkins cat /var/jenkins_home/secrets/initialAdminPassword
    2. GitLab

      1. Browse here

        https://v-ubuntu-devops:8989/users/sign_in
      2. Retrieve the initial password via:

        sudo docker exec -it My-GitLab grep 'Password:' /etc/gitlab/initial_root_password