docker build gitlab for centos7

1.build gitlab

Its operating environment consists of three parts:
postgresql
redis
gitlab
2. docker pull gitlab

[root@VM_0_7_centos ~]# docker search gitlab
INDEX       NAME                                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/gitlab/gitlab-ce                             GitLab Community Edition docker image base...   1994                 [OK]
docker.io   docker.io/sameersbn/gitlab                             Dockerized gitlab web server                    1044                 [OK]
docker.io   docker.io/gitlab/gitlab-runner                         GitLab CI Multi Runner used to fetch and r...   355                  [OK

3.download gitlab file

[root@VM_0_7_centos ~]# docker pull docker.io/gitlab/gitlab-ce
Using default tag: latest
Trying to pull repository docker.io/gitlab/gitlab-ce ... 
latest: Pulling from docker.io/gitlab/gitlab-ce
8ee29e426c26: Pull complete 
6e83b260b73b: Pull complete 
e26b65fd1143: Pull complete 
40dca07f8222: Pull complete 
b420ae9e10b3: Pull complete 
a218309dd589: Pull complete 
5c60fd7ba0ce: Pull complete 
659c2144b5a3: Pull complete 
8289bbac0d0e: Pull complete 
31bbd150e8a7: Pull complete 
9114e78243fa: Pull complete 
Digest: sha256:03bad28bc2d041d0a0fcb0ad9fb1a6466a9519cd981b1694cb954057b56fa7c0
Status: Downloaded newer image for docker.io/gitlab/gitlab-ce:latest
[root@VM_0_7_centos ~]# docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
docker.io/wordpress          latest              9414c91da9a8        9 days ago          408 MB
docker.io/gitlab/gitlab-ce   latest              d87e1ba8aa5f        13 days ago         1.46 GB
docker.io/mariadb            latest              2c73b3262fff        2 weeks ago         363 MB
docker.io/hello-world        latest              2cb0d9787c4d        4 weeks ago         1.85 kB

4.start postgresql:

[root@VM_0_7_centos ~]# docker run --name gitlab-postgre-sql -d  --env 'DB_NAME=gitlabhq_production'--env 'DB_USER=gitlab' --env 'DB_PASS=password' sameersbn/postgresql:9.4-12
/usr/bin/docker-current: Error parsing reference: "DB_USER=gitlab" is not a valid repository/tag: invalid reference format.
See '/usr/bin/docker-current run --help'.
[root@VM_0_7_centos ~]# docker run --name gitlab-postgre-sql -d  --env 'DB_NAME=gitlabhq_production' --env 'DB_USER=gitlab' --env 'DB_PASS=password' sameersbn/postgresql:9.4-12
Unable to find image 'sameersbn/postgresql:9.4-12' locally
Trying to pull repository docker.io/sameersbn/postgresql ... 
9.4-12: Pulling from docker.io/sameersbn/postgresql
8387d9ff0016: Pull complete 
3b52deaaf0ed: Pull complete 
4bd501fad6de: Pull complete 
a3ed95caeb02: Pull complete 
012013682669: Pull complete 
798cd0ed4a93: Pull complete 
69dd52628887: Pull complete 
e15547401b0e: Pull complete 
Digest: sha256:05227ee56e789cc38db3f2882bf1e0beb138785e9de1634b4b25c3d238c9536d
Status: Downloaded newer image for docker.io/sameersbn/postgresql:9.4-12
e9bba5e833b6fd4fc806515a79171e63882891295b6248505e6f72994c2f734c

5.start redis:

[root@VM_0_7_centos ~]# docker run --name gitlab-redis -d sameersbn/redis:latest
Unable to find image 'sameersbn/redis:latest' locally
Trying to pull repository docker.io/sameersbn/redis ... 
latest: Pulling from docker.io/sameersbn/redis
6b98dfc16071: Pull complete 
4001a1209541: Pull complete 
6319fc68c576: Pull complete 
b24603670dc3: Pull complete 
97f170c87c6f: Pull complete 
7d135204708d: Pull complete 
f4925e37053a: Pull complete 
Digest: sha256:b6c8f5f855cdc6a9ed6ea02317eae865b3c938654e6454970827ab89812a927e
Status: Downloaded newer image for docker.io/sameersbn/redis:latest
511be91cca0a8f2eeaf94decfa1bc902226a7a37f1c294590224271f6d9f2806

6.start gitlab:

[root@VM_0_7_centos ~]# docker run --name gitlab -d --link gitlab-postgre-sql:postgresql --link gitlab-redis:redisio --publish  10022:22 --publish 10080:80 --env 'GITLAB_POST=10080' --env 'GITLAB_SSH_POST=10022' --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' sameersbn/gitlab:8.4.4
e82be96b0af5a132454fcf02884992180208eb3b754e9d6e4291b32014b4ed07

7.view port

[root@VM_0_7_centos ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      827/httpd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      828/sshd            
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      14453/zabbix_agentd 
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      10745/zabbix_server 
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1219/mysqld         
tcp6       0      0 :::111                  :::*                    LISTEN      10815/rpcbind       
tcp6       0      0 :::8080                 :::*                    LISTEN      11164/docker-proxy- 
tcp6       0      0 :::3000                 :::*                    LISTEN      10278/grafana-serve 
tcp6       0      0 :::10080                :::*                    LISTEN      23918/docker-proxy- 
tcp6       0      0 :::10050                :::*                    LISTEN      14453/zabbix_agentd 
tcp6       0      0 :::10051                :::*                    LISTEN      10745/zabbix_server 
tcp6       0      0 :::10022                :::*                    LISTEN      23928/docker-proxy-

8.view docker status

[root@VM_0_7_centos ~]# docker ps -a
CONTAINER ID        IMAGE                         COMMAND                  CREATED              STATUS                   PORTS                                                   NAMES
c23102334507        sameersbn/gitlab:8.4.4        "/sbin/entrypoint...."   About a minute ago   Up About a minute        443/tcp, 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp   gitlab
511be91cca0a        sameersbn/redis:latest        "/sbin/entrypoint.sh"    51 minutes ago       Up 51 minutes            6379/tcp                                                gitlab-redis
e9bba5e833b6        sameersbn/postgresql:9.4-12   "/sbin/entrypoint.sh"    56 minutes ago       Up 56 minutes            5432/tcp                                                gitlab-postgre-sql
8001906c5274        wordpress                     "docker-entrypoint..."   2 hours ago          Up 2 hours               0.0.0.0:8080->80/tcp                                    MyWordPress
da706ccdc499        mariadb                       "docker-entrypoint..."   2 hours ago          Up 2 hours               3306/tcp                                                db
a650e5202d27        hello-world                   "/hello"                 2 hours ago          Exited (0) 2 hours ago                                                           thirsty_carson
3f42d867d0ba        hello-world                   "/hello"                 2 hours ago          Exited (0) 2 hours ago                                                           peaceful_euclid

9.access gitlab

url:http://111.231.108.211:10080
user:
password:

猜你喜欢

转载自blog.csdn.net/qq_40279031/article/details/81639117