使用Docker安装Gitlab

  1. Install Prerequisites
    1. Due to a known issue with the dependencies of the docker .deb, installing docker on a Debian/Ubuntu VM requires an additional step:apt-get install dmsetup && dmsetup mknodes
  2. Install Docker
    Use the Docker-maintained install script for Debian or Ubuntu. For other operating systems, see the Docker Installation guides.
    1. Run:curl -sSL https://get.docker.com/ | sh
      注:

      The current version of the docker script checks for AUFS support and displays the warning below if support is not found:

      Warning: current kernel is not supported by the linux-image-extra-virtual package. We have no AUFS support. Consider installing the packages linux-image-virtual kernel and linux-image-extra-virtual for AUFS support. + sleep 10

      This message can be safely ignored, as the script will continue the installation using DeviceMapper or OverlayFS. If you require AUFS support, you will need to configure a distribution supplied or custom compiled kernel.

    2. If necessary, add the non-root user to the “docker” group:sudo usermod -aG docker example_user
  3. Run the image
    sudo docker run --detach \
        --hostname git.eduhe.com \
        --publish 443:443 --publish 80:80 --publish 82:82 \
        --name gitlab \
        --restart always \
        --volume /srv/gitlab/config:/etc/gitlab \
        --volume /srv/gitlab/logs:/var/log/gitlab \
        --volume /srv/gitlab/data:/var/opt/gitlab \
        gitlab/gitlab-ce:latest
    This will download and start a GitLab CE container and publish ports needed to access SSH, HTTP and HTTPS. All GitLab data will be stored as subdirectories of /srv/gitlab/. The container will automatically restart after a system reboot.
  4. Upgrade GitLab to newer version
    1. Stop the running container:sudo docker stop gitlab
    2. Remove existing container:udo docker rm gitlab
    3. Pull the new image:sudo docker pull gitlab/gitlab-ce:latest
    4. Create the container once again with previously specified options:
      sudo docker run --detach \
      --hostname git.eduhe.com \
      --publish 443:443 --publish 80:80 --publish 82:82 \
      --name gitlab \
      --restart always \
      --volume /srv/gitlab/config:/etc/gitlab \
      --volume /srv/gitlab/logs:/var/log/gitlab \
      --volume /srv/gitlab/data:/var/opt/gitlab \
      gitlab/gitlab-ce:latest