LoginSignup
0
0

More than 1 year has passed since last update.

DockerでGitLab環境構築

Posted at

Docker超初心者が、GitLabを入れたときのメモです。

0.環境

  • OS - CentOS8
  • Docker - 20.10.17

1.GitLab Docker imagesの取得

$ docker pull gitlab/gitlab-ce

私は無料版のgitlab-ceにしました。有料版がいい方はceeeにしてください。

2.ボリュームの場所を設定する

他のすべてを設定する前に、構成、ログ、およびデータ・ファイルが存在するディレクトリーを指す新しい環境変数を構成します。ディレクトリーが存在し、適切な許可が付与されていることを確認してください。$GITLAB_HOME

とのことなので、まずディレクトリを作ります(既にある方はスキップ)。

$ mkdir /srv/gitlab

パスを設定します。

$ export GITLAB_HOME=/srv/gitlab

3.Docker Compose を使って GitLab をインストールする

複数やり方があるようですが、今回はDocker Composeを使ってインストールします。
以下をコピペすると無料版GitLab ver3.6がインストールされ、http://localhost:80に接続することで確認できます。

docker-compose.yml
version: '3.0'
services:
  web:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'localhost'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://localhost:80'
    ports:
      - '80:80'
      - '443:443'
      - '22:22'
    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'
    shm_size: '256m'

Error starting userland proxy: listen tcp4 0.0.0.0:xxx: bind: address already in use. が出た場合

ポート番号xxxが既に使用されている場合のエラーでlsof -i -P | grep "LISTEN"を実行して何に使用されているかを確認したら、当該サービスを停止 or 別のポート番号を割り当てる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0