質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

解決済

1回答

2762閲覧

dockerが正常に起動しません。portが割り当てられないようです。

kokopi

総合スコア4

docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2020/08/03 16:25

詳細

docker-compose up -d したのですが、コンテナの方にportが割り当てられていない?ようです
docker psした結果は以下です。

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 63d2e3291189 gitlab/gitlab-runner:alpine-v9.4.2 "/usr/bin/dumb-init …" 2 minutes ago Up 2 minutes gitlab-runner.si 106fe5878022 gitlab/gitlab-ce "/assets/wrapper" 2 minutes ago Restarting (1) 23 seconds ago webroot_gitlab_1

curl http://localhost と実行しても
”curl: (7) Failed connect to localhost:80; Connection refused”となってしまします。
正常にdockerを起動させるためには、どうすれば良いでしょうか

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yurak

2020/08/03 16:33

image名からcommunity版GitLabを起動させようとしていると思料します。 `docker-compose.yaml`を追記いただくことは可能でしょうか?
y_shinoda

2020/08/03 16:33

差し支えなければ Compose ファイル (docker-compose.yml など) を 質問欄に次の記法で追記おねがいします ```yaml (ここに Compose ファイルの内容を記載) ```
yurak

2020/08/03 16:34

webアクセスできないのは、webroot_gitlab_1のイメージが正常に稼働していないためです。
kokopi

2020/08/04 01:09

こんなに早く回答されているとは思いませんでした。。返事が遅れてすみません docker-compose.yamlの内容は以下になります 人からもらったファイルをなんとなくで使っているので、内容について全て理解してはいません。。勉強不足で申し訳ないです ```docker-compose.yaml version: '3.7' services: gitlab: image: gitlab/gitlab-ce hostname: 'XXXXXXXXXXXX' networks: - extnet - int_net ports: - "80:80" - "443:443" - "2222:2222" restart: always volumes: - ./config:/etc/gitlab - ./logs:/var/log/gitlab - ./data:/var/opt/gitlab runner: image: gitlab/gitlab-runner:alpine-v9.4.2 hostname: gitlab-runner.si.local tty: true container_name: gitlab-runner.si depends_on: - gitlab networks: - extnet - int_net env_file: .env volumes: - ./srv/gitlab-runner/config:/etc/gitlab-runner - /var/run/docker.sock:/var/run/docker.sock restart: always logging: driver: "json-file" options: max-size: "10m" max-file: "3" networks: extnet: name: si.local int_net: name: si-internal.local ``` すみません。よろしくお願いします
guest

回答1

0

ベストアンサー

追記

使用している環境はCentOSです。
docker-compose logs でログを確認してみたところ、
ファイルの権限が問題で読み込めないとのエラーが出ていました。
該当のファイルの権限を変更し、
再度コンテナを起動しても以下のようなエラーがたくさん出ていました。

次のようなコマンドで修正できるようです:

console

1sudo docker exec gitlab update-permissions 2sudo docker restart gitlab

注: 上記コマンドの "gitlab" は起動したもののうまく動いていないコンテナー名を表します

参考: Permission problems | GitLab Docker images | GitLab

元の回答

Docker を動かしているコンピューターが Windows であれば、

yaml

1 volumes: 2 - ./config:/etc/gitlab 3 - ./logs:/var/log/gitlab 4 - ./data:/var/opt/gitlab

上記の箇所で bind マウントが使われていますが、
bind マウントではなく volumes を使う必要があるようです
これはマウント先のパスでシンボリックリンクを使うためであるようです

参考:
Based On Closed Issue At: https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1601 (#2280) · Issues · GitLab.org / omnibus-gitlab · GitLab
Manage data in Docker | Docker Documentation

こちらでは、次のようなエラーが表示されました:

console

1gitlab_1 | Running handlers: 2gitlab_1 | There was an error running gitlab-ctl reconfigure: 3gitlab_1 | 4gitlab_1 | storage_directory[/var/opt/gitlab/.ssh] (gitlab::gitlab-shell line 34) had an error: Mixlib::ShellOut::ShellCommandFailed: ruby_block[directory resource: /var/opt/gitlab/.ssh] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb line 34) had an error: Mixlib::ShellOut::ShellCommandFailed: Failed asserting that ownership of "/var/opt/gitlab/.ssh" was git:git 5gitlab_1 | ---- Begin output of set -x && [ "$(stat --printf='%U:%G' $(readlink -f /var/opt/gitlab/.ssh))" = 'git:git' ] ---- 6gitlab_1 | STDOUT: 7gitlab_1 | STDERR: + readlink -f /var/opt/gitlab/.ssh 8gitlab_1 | + stat --printf=%U:%G /var/opt/gitlab/.ssh 9gitlab_1 | + [ root:root = git:git ] 10gitlab_1 | ---- End output of set -x && [ "$(stat --printf='%U:%G' $(readlink -f /var/opt/gitlab/.ssh))" = 'git:git' ] ---- 11gitlab_1 | Ran set -x && [ "$(stat --printf='%U:%G' $(readlink -f /var/opt/gitlab/.ssh))" = 'git:git' ] returned 1 12gitlab_1 | 13gitlab_1 | Running handlers complete 14gitlab_1 | Chef Infra Client failed. 7 resources updated in 07 seconds

この原因ではないと思われる場合は docker-compose logs
エラーメッセージが表示されていないか確認してみましょう

参考: docker-compose logs | Docker Documentation

投稿2020/08/04 02:26

編集2020/08/04 06:31
y_shinoda

総合スコア3272

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kokopi

2020/08/04 05:36 編集

回答ありがとうございます。使用している環境はCentOSです。 docker-compose logs でログを確認してみたところ、ファイルの権限が問題で読み込めないとのエラーが出ていました。 該当のファイルの権限を変更し、再度コンテナを起動しても以下のようなエラーがたくさん出ていました。 ``` gitlab_1 | ==> /var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-2020-08-04-04-14-54.log <== gitlab_1 | Rails Error: Unable to access log file. Please ensure that /opt/gitlab/embedded/service/gitlab-rails/log/production.log exists and is writable (ie, make it writable for user and group: chmod 0664 /opt/gitlab/embedded/service/gitlab-rails/log/production.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed. gitlab_1 | rake aborted! gitlab_1 | Errno::EACCES: Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/log/grpc.log gitlab_1 | /opt/gitlab/embedded/service/gitlab-rails/config/initializers/grpc.rb:3:in `new' gitlab_1 | /opt/gitlab/embedded/service/gitlab-rails/config/initializers/grpc.rb:3:in `<top (required)>' gitlab_1 | /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:5:in `<top (required)>' gitlab_1 | /opt/gitlab/embedded/bin/bundle:23:in `load' gitlab_1 | /opt/gitlab/embedded/bin/bundle:23:in `<main>' gitlab_1 | Tasks: TOP => gitlab:db:configure => environment gitlab_1 | (See full trace by running task with --trace) ``` ただコンテナは起動するようになったのですが、 ``` CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8b9e774b1fa8 gitlab/gitlab-runner:alpine-v9.4.2 "/usr/bin/dumb-init …" 11 minutes ago Up 11 minutes gitlab-runner.si b9c2421b4093 gitlab/gitlab-ce:latest "/assets/wrapper" 11 minutes ago Up 11 minutes (healthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 22/tcp, 0.0.0.0:2222->2222/tcp webroot_gitlab_1 ``` curl http://localhostとコマンドを打つと以下のようなhtmlが返ってくるようになりました。。 ``` <html> <head><title>301 Moved Permanently</title></head> <body> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx</center> </body> </html> ```
y_shinoda

2020/08/04 06:31

回答に追記しました
kokopi

2020/08/04 06:41

ありがとうございます。 エラーは解決できたみたいなのですが、やはり301に遷移してしまいます。 ただ最初の質問内容と大分内容が変わってきたので一旦こっちの質問はcloseします。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問