Aliyun server building Docker

Software installation First install the appro...

Software installation

First install the appropriate software:

apt update apt install software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt update apt-cache policy docker-ce apt-get install -y docker-ce

Surprisingly, the installation of Docker is so simple. Here are some common instructions of Docker.

Docker's command

1. Restart docker service

systemctl daemon-reload systemctl restart docker

2. View the current docker process

docker ps

3. View the current docker status

docker stats

4. Turn on a mirror image

docker start image name(ID)

5. Close a mirror

docker stop image name(ID)

6. Restart a mirror

docker restart image name(ID)

7. Enter a mirror command line

docker exec -it image name(ID)

for instance

Here is an example of running Gitlab:

Distributed installation
  1. Docker installs postgresql image and uses
docker run --name postgresql -d -e 'DB_NAME=gitlabhq_production' -e 'DB_USER=gitlab' -e 'DB_PASS=password' -e 'DB_EXTENSION=pg_trgm' -v /home/root/opt/postgresql/data:/var/lib/postgresql sameersbn/postgresql
  1. Docker installs redis image and uses
docker run --name redis -d -v /home/root/opt/redis/data:/var/lib/redis sameersbn/redis
  1. Docker installs the gitlab image and uses the previous postgresql and redis databases
docker run --name gitlab --link postgresql:postgresql --link redis:redisio -m 600m -p 10022:22 -p 80:80 -e 'GITLAB_PORT=80' -e 'GITLAB_SSH_PORT=10022' -e 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' -e 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' -e 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' -e 'GITLAB_HOST=gitlab.adoregeek.com' -e 'GITLAB_BACKUP_SCHEDULE=daily' -e 'GITLAB_BACKUP_TIME=10:30' -v /home/root/opt/gitlab/data:/home/git/data sameersbn/gitlab
One click installation
sudo docker run --detach \ --hostname gitlab.adoregeek.com \ --publish 443:443 --publish 10080:80 --publish 10022: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

These are the two ways to install docker. If docker is not used, we need to install PostgreSQL and redis step by step. After configuration, we need to install gitlab. Each step is cumbersome and hard to migrate. We need to reinstall the next time we change machines. Docker solves these problems easily, so you don't need to worry about these configurations and use them easily.

4 May 2020, 15:41 | Views: 2703

Add new comment

For adding a comment, please log in
or create account

0 comments