docker - 运行 Gitlab Docker

标签 docker gitlab

我正在遵循以下说明: http://doc.gitlab.com/omnibus/docker

但是 http://localhost 表示 网页不可用

这是我正在运行的命令(Ubuntu 14.04 LTS):

    ole@MKI:~$ docker version
    Client:
     Version:      1.9.1
     API version:  1.21
     Go version:   go1.4.3
     Git commit:   a34a1d5
     Built:        Fri Nov 20 17:56:04 UTC 2015
     OS/Arch:      linux/amd64

    Server:
     Version:      1.9.1
     API version:  1.21
     Go version:   go1.4.3
     Git commit:   a34a1d5
     Built:        Fri Nov 20 17:56:04 UTC 2015
     OS/Arch:      linux/amd64

    ole@MKI:~$ sudo docker run --detach \
    >     --hostname gitlab.example.com \
    >     --publish 443:443 --publish 80:80 --publish 22:22 \
    >     --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
    613d4d2d612f977d3d25746a169d9209acb864e57c5184083dccd02b1e4a157c

    ole@MKI:~$ docker ps
    CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS              PORTS                                                          NAMES
    613d4d2d612f        gitlab/gitlab-ce:latest   "/assets/wrapper"   4 seconds ago       Up 2 seconds        0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   gitlab

如果我重新运行 docker ps 我会得到:

    CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                              PORTS                                                          NAMES
    613d4d2d612f        gitlab/gitlab-ce:latest   "/assets/wrapper"   9 minutes ago       Restarting (1) About a minute ago   0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   gitlab

上面写着Restarting about a minute ago... ...这是否意味着内部有问题?

[编辑 - 添加日志]

  ole@MKI:~$ sudo mkdir -p /var/log/gitlab/reconfigure

  ole@MKI:~$ sudo docker run --detach \
  >     --hostname gitlab.example.com \
  >     --publish 443:443 --publish 80:80 --publish 22:22 \
  >     --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
  f4dee0a603bdc95594e8a77d51762f2d78d44ec077f2d57645e651ed628a4d6b

  ole@MKI:~$ docker logs
  docker: "logs" requires 1 argument.
  See 'docker logs --help'.

  Usage:    docker logs [OPTIONS] CONTAINER

  Fetch the logs of a container

  ole@MKI:~$ docker logs gitlab
  Thank you for using GitLab Docker Image!
  Current version: gitlab-ce=8.5.0-ce.1

  Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
  And restart this container to reload settings.
  To do it use docker exec:

    docker exec -it gitlab vim /etc/gitlab/gitlab.rb
    docker restart gitlab

  For a comprehensive list of configuration options please see the Omnibus GitLab readme
  https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  If this container fails to start due to permission problems try to fix it by executing:

    docker exec -it gitlab update-permissions
    docker restart gitlab

  Preparing services...
  Starting services...
  Configuring GitLab...
  /opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
  /opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
  [2016-02-23T01:16:47+00:00] FATAL: Failed to open or create log file at /var/log/gitlab/reconfigure/1456190207.log: Errno::ENOENT (No such file or directory @ rb_sysopen - /var/log/gitlab/reconfigure/1456190207.log)
  [2016-02-23T01:16:47+00:00] FATAL: Aborting due to invalid 'log_location' configuration
  Thank you for using GitLab Docker Image!
  Current version: gitlab-ce=8.5.0-ce.1

  Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
  And restart this container to reload settings.
  To do it use docker exec:

    docker exec -it gitlab vim /etc/gitlab/gitlab.rb
    docker restart gitlab

  For a comprehensive list of configuration options please see the Omnibus GitLab readme
  https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  If this container fails to start due to permission problems try to fix it by executing:

    docker exec -it gitlab update-permissions
    docker restart gitlab

  Preparing services...
  Starting services...
  Configuring GitLab...
  /opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
  /opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
  [2016-02-23T01:16:51+00:00] FATAL: Failed to open or create log file at /var/log/gitlab/reconfigure/1456190211.log: Errno::ENOENT (No such file or directory @ rb_sysopen - /var/log/gitlab/reconfigure/1456190211.log)
  [2016-02-23T01:16:51+00:00] FATAL: Aborting due to invalid 'log_location' configuration
  Thank you for using GitLab Docker Image!
  Current version: gitlab-ce=8.5.0-ce.1

  Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
  And restart this container to reload settings.
  To do it use docker exec:

    docker exec -it gitlab vim /etc/gitlab/gitlab.rb
    docker restart gitlab

  For a comprehensive list of configuration options please see the Omnibus GitLab readme
  https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  If this container fails to start due to permission problems try to fix it by executing:

    docker exec -it gitlab update-permissions
    docker restart gitlab

  Preparing services...
  Starting services...
  Configuring GitLab...
  /opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
  /opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
  [2016-02-23T01:16:56+00:00] FATAL: Failed to open or create log file at /var/log/gitlab/reconfigure/1456190216.log: Errno::ENOENT (No such file or directory @ rb_sysopen - /var/log/gitlab/reconfigure/1456190216.log)
  [2016-02-23T01:16:56+00:00] FATAL: Aborting due to invalid 'log_location' configuration
  Thank you for using GitLab Docker Image!
  Current version: gitlab-ce=8.5.0-ce.1

  Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
  And restart this container to reload settings.
  To do it use docker exec:

    docker exec -it gitlab vim /etc/gitlab/gitlab.rb
    docker restart gitlab

  For a comprehensive list of configuration options please see the Omnibus GitLab readme
  https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  If this container fails to start due to permission problems try to fix it by executing:

    docker exec -it gitlab update-permissions
    docker restart gitlab

  Preparing services...
  Starting services...
  Configuring GitLab...
  /opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
  /opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
  [2016-02-23T01:17:02+00:00] FATAL: Failed to open or create log file at /var/log/gitlab/reconfigure/1456190222.log: Errno::ENOENT (No such file or directory @ rb_sysopen - /var/log/gitlab/reconfigure/1456190222.log)
  [2016-02-23T01:17:02+00:00] FATAL: Aborting due to invalid 'log_location' configuration
  Thank you for using GitLab Docker Image!
  Current version: gitlab-ce=8.5.0-ce.1

  Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
  And restart this container to reload settings.
  To do it use docker exec:

    docker exec -it gitlab vim /etc/gitlab/gitlab.rb
    docker restart gitlab

  For a comprehensive list of configuration options please see the Omnibus GitLab readme
  https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

  If this container fails to start due to permission problems try to fix it by executing:

    docker exec -it gitlab update-permissions
    docker restart gitlab


  ole@MKI:~$ docker ps
  CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                         PORTS                                                          NAMES
  f4dee0a603bd        gitlab/gitlab-ce:latest   "/assets/wrapper"   39 seconds ago      Restarting (1) 4 seconds ago   0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   gitlab

即使在手动创建 /var/log/gitlab/reconfigure 之后,它仍然无法启动。

最佳答案

修改 docker 命令为以下解决了我的问题:

sudo docker run -i \
    --hostname ubuntu \
    --publish 443:443 --publish 80:80 --publish 2222:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    --volume /srv/gitlab/logs/reconfigure:/var/log/gitlab/reconfigure \
    gitlab/gitlab-ce:latest

注意我使用了 -i 所以我可以看到它启动,但你可以将它设置回 --detach

关于docker - 运行 Gitlab Docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35562995/

相关文章:

docker - docker 上的沙发数据库 : open console

docker - 如何在 Docker 中配置 WSO2 API-M 3.0.0 和 API-M Analytics 3.0.0?

jenkins - Gitlab webhook 获取错误:500 内部服务器错误 - URI::InvalidURIError

Gitlab pull 一个分支到本地机器

gitlab - 在 GitLab 中更改导航主题颜色

tags - 如何在 GitLab 中接受合并请求后自动创建标签?

amazon-web-services - 如何在 Jenkins 中将 Docker 镜像推送到 ECR?

docker - 在 Jenkins docker.build 中使用 docker buildx 功能

docker - Docker:使用多个YAML文件时删除设置

git - PHPStorm key 对设置以使用 gitlab