Docker Installation Gitlab+redis+mysql Tutorial detailed

Source: Internet
Author: User
Tags numeric mkdir mysql tutorial redis docker ps docker run

Today, the company requirements in the Docker installation Gitlab+mysql, after a day of tossing, finally finished.
System: CentOS 6.5 (64-bit)
1. First install and start Docker
This step is no longer introduced, you see my previous CentOS 6.5 installed Docker and Jenkins article bar.

2. Installation Preparation
Mkdir/srv/docker/gitlab/mysql-pv
Mkdir/srv/docker/gitlab/redis-pv
Mkdir/srv/docker/gitlab/gitlab-pv
Mkdir/srv/docker/gitlab/log-pv

Chcon-rt Svirt_sandbox_file_t/srv/docker/gitlab/mysql
Chcon-rt Svirt_sandbox_file_t/srv/docker/gitlab/redis
Chcon-rt Svirt_sandbox_file_t/srv/docker/gitlab/gitlab

3. Install MySQL Redis gitlab
Docker Pull Sameersbn/mysql:latest
Docker Pull Sameersbn/redis:latest
Docker Pull Sameersbn/gitlab:latest

When we're done, we use Docker images to see if the 3 mirrors exist.

4. Start MySQL and Redis first
Docker run--name=gitlab-mysql-tid \
--env= ' Db_name=gitlabhq_production '
--env= ' Db_user=gitlab '--env= ' db_pass=passwd '
--volume=/srv/docker/gitlab/mysql:/var/lib/mysql \
Sameersbn/mysql:latest

Docker run--name gitlab-redis-tid \
--volume/srv/docker/gitlab/redis:/var/lib/redis \
Sameersbn/redis:latest

OK, after these 2 starts up, we use Docker ps-a to see if we are running, or we can use Docker logs gitlab-mysql to view the installation process.

5. Start Gitlab
Docker run--name gitlab-tid \
--link gitlab-mysql:mysql--link gitlab-redis:redisio \
-P 10022:22-p 10,080:80 \
-e ' gitlab_host=your-gitlab-ip ' \
-E ' gitlab_port=10080 '-e ' gitlab_ssh_port=10022 ' \
-e ' gitlab_secrets_db_key_base=long-and-random-alpha-numeric-string ' \
-v/srv/docker/gitlab/gitlab:/home/git/data \
-v/srv/docker/gitlab/log:/var/log/gitlab \
Sameersbn/gitlab:latest

Ps:
environment variable Gitlab_host, gitlab_secrets_db_key_base is necessary, otherwise startup is unsuccessful.
The long-and-random-alpha-numeric-string in the above command is replaced with a random set of strings that can be generated using PWGEN-BSV1 64来.

OK, if you start successfully, go to the browser to verify:
http://your-gitlab-ip:10080
Enter preset account number and password:
Username:root
Password:5ivel!fe

6. Add Startup Item
Echo ' docker start Gitlab_redis ' >>/etc/rc.local
Echo ' docker start Gitlab_mysql ' >>/etc/rc.local
Echo ' docker start Gitlab ' >>/etc/rc.local

7. Enter the Docker container
Enter interactive mode:
Docker exec-it Gitlab Bash

Enter non-interactive mode:
Docker Run-tid-t Sameersbn/gitlab/bin/bash

To delete all running containers:
Docker RM $ (Docker ps-q-a)

To stop all running containers:
Docker kill $ (Docker Ps-q-a)

Well, the rest of the usage will be for you to find.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.