(For myself) Build gitlab with ubuntu18.04 + docker for home (Note)


Good evening Even though I have a lot of things I want to do and study It's around this time that I haven't had enough time to think about the birth of Nico and Mahjong Soul.

My workplace, which has only used svn, is about to use git. Since I came out, I will build gitlab at home after studying.

Building Ubuntu 18.04

First, create an environment to build gitlab. This time I would like to make ubuntu 18.04 on esxi.

  1. Selection of creation type image.png This time select a new virtual machine.

  2. Name and guest OS selection image.png

  3. Storage selection image.png

  4. Customize settings image.png I made the settings like this. There is nothing special, but what you should be careful about is that you do not forget to set the ISO file on the CD / DVD media. If you do not do this, you will not be able to install ubuntu.

  5. Done Press Finish to create the image.

Ubuntu installation

  1. Start up image.png First, start it.

  2. Select install Ubuntu image.png

  3. Keyboard layout image.png

  4. Updates and other software image.png

  5. Installation type image.png

  6. Where do you live? image.png I was born in Tokyo, raised in HIP HOP, and most of the bad guys are friends

  7. Please enter your information image.png

  8. Installation image.png Wait for a while until the installation is complete.

  9. Reboot image.png Restart.

docker, docker-compose After restarting, first install docker and docker-compoe.

  1. docker

Basically, install docker according to docker official.


sudo apt-get remove docker docker-engine docker.io containerd runc

# Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \

# Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels.
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \

sudo apt-get update

# docker install
sudo apt-get install docker-ce docker-ce-cli containerd.io

Set so that docker can be executed without root privileges.


sudo groupadd docker

sudo usermod -aG docker $USER

#It seems that it will be reflected if you log out, but it was not reflected in my environment
#Reboot once here.
sudo reboot

#After restarting, it is OK if docker is displayed



# docker-Click here to install by specifying the version of ce
# List the versions available in your repo:
apt-cache madison docker-ce

sudo apt-get install docker-ce=5:19.03.12~3-0~ubuntu-bionic docker-ce-cli=5:19.03.12~3-0~ubuntu-bionic containerd.io

I will test


# Verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world

#Check if there is an image
docker ps -a

image.png Looks okay

2. docker-compose


sudo apt install docker-compose

#Confirmation of installation
docker-compose -v
#OK if ↓ is displayed(Please read version as appropriate)
docker-compose version 1.17.1 build unknown


gitlab Finally it is the construction of gitlab. Let's take a look at gitlab official.

Since it imitates the official docker-compose.yml, first define the environment variables


#Create a folder first
sudo mkdir -p /srv/gitlab
#Environment variable
export GITLAB_HOME="/srv/gitlab"


#Create a suitable folder
mkdir gitlab && cd gitlab

# docker-compose.make yml
touch docker-compose.yml

#Open with editor and write the contents
gedit docker-compose.tml


  image: 'gitlab/gitlab-ce:latest'
  hostname: 'IP address of own PC'
  restart: always
      external_url 'http://IP address of own PC:80/gitlab/'
      gitlab_rails['time_zone'] = 'Asia/Tokyo'
    - '80:80'
    - '443:443'
    - '22:22'
    - '$GITLAB_HOME/config:/etc/gitlab'
    - '$GITLAB_HOME/logs:/var/log/gitlab'
    - '$GITLAB_HOME/data:/var/opt/gitlab'

docker-compose.yml looks like this. It seems that there are other setting items, so let's add them if necessary. Also, when considering operation, should I fix the version of gitlab? Also, if you already have a port in use, replace it with an appropriate number.


#Start gitlab
docker-compose up -d

It takes a long time to start. Let's wait patiently.

After starting, open a browser and hit the URL specified by external_url. It is OK if the screen below is displayed. After that, change the administrator PW and register the user from Register. Example: http: // IP address of your PC: 80 / gitlab / image.png

At the end

Now you can build gitlab environment on ubuntu 18.04 using docker and docker-compose. When building in a company, it may be necessary to set proxy in ubuntu or docker, but at home it is OK like this. I'm grateful that you can build gitlab at home so easily. By the way, when I installed gitlab directly on ubuntu on-premise, it stopped working by updating the settings of gitlab for some reason and it didn't work. Well, it seems easier to use docker, so let's say Yoshi!

Reference URL

https://docs.docker.com/engine/install/ubuntu/ https://docs.gitlab.com/omnibus/docker/ https://qiita.com/soumi/items/baaa35b37f6c90a66c0c http://imamachi-n.hatenablog.com/entry/2018/04/29/193718 https://demura.net/deeplearning/16931.html

Thanks for the URL above.

Recommended Posts

(For myself) Build gitlab with ubuntu18.04 + docker for home (Note)
[Note] I suddenly can't build with Docker for windows.
Build mecab (NEologd dictionary) environment with Docker (ubuntu)
How to build docker environment with Gradle for intelliJ
Build an Android image for Orange Pi 4 with Docker
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
Build GitLab / Mattermost with DockerForWindows
Set up GitLab with docker
Build docker environment with WSL
Build Ubuntu 18.04.5 with dual boot
Build DynamoDB local with Docker
(For myself) Build an IDE that you can touch from a browser with docker (trial)
Build Couchbase local environment with Docker
Install java with Ubuntu 16.04 based Docker
Build a Node.js environment with Docker
Build a SPA for Laravel 6.2 / Vue.js / Nginx / Mysql / Redis with Docker
Environment construction with Docker for beginners
Build PlantUML environment with VSCode + Docker
Build environment with vue.js + rails + docker
Enable OpenCV with java8. (For myself)
Build Rails environment with Docker Compose
Build a development environment for Django + MySQL + nginx with Docker Compose
Docker execution memo summarized for myself
docker single container restart for myself
Build ffmpeg 4.3.1 on Ubuntu for Windows
Build docker + laravel environment with laradock
Build WebRTC Janus with Docker container
Spring Boot gradle build with Docker
Build debug environment on container --Build local development environment for Rails tutorial with Docker-
Make a daily build of the TOPPERS kernel with Gitlab and Docker
Build a local development environment for Rails tutorials with Docker (Rails 6 + PostgreSQL + Webpack)
Template: Build a Ruby / Rails development environment with a Docker container (Ubuntu version)
Getting Started with Docker for Mac (Installation)
Build a Wordpress development environment with Docker
Build OpenCV with Java Wrapper on Ubuntu 18.04
Build Cakephp environment from docker installation Ubuntu
[Docker] Build Jupyter Lab execution environment with Docker
Build an environment with Docker on AWS
Run Ubuntu + ROS with Docker on Mac
Time shift measures with Docker for Windows
Build TensorFlow operation check environment with Docker
How to build Rails 6 environment with Docker
Note Book: OpenCV v4.5.0-dev On Ubuntu 20.04 But Didn't work cmake build for Java
[Error resolution] Occurs when trying to build an environment for spring with docker
Build a development environment for Docker + Rails6 + Postgresql
Links & memos for getting started with Java (for myself)
Build a WordPress development environment quickly with Docker
A note for those who live with JMockit
[Ubuntu 18.04] Environment construction for using PyTorch with RTX3090
[Docker for Mac] Deal with Credentials store error
Build a container for Docker x Laravel phpMyAdmin
Docker Container Operations with Docker-Client API for Java
Build a development environment for Docker, java, vscode
How to use nginx-ingress-controller with Docker for Mac
[Rails] How to build an environment with Docker
[First team development ②] Build an environment with Docker
Deploy Line bot with rails5 + Docker + Heroku Note
3 Tips to Improve Lead Time for Docker Build
Build a local development environment for Open Distro for Elasticsearch with multiple nodes using Docker