编程知识 cdmana.com

Docker compose pit entry

install docker-compose

 Download mode (1)
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 Download mode (2)
$ wget https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m) -O /usr/local/bin/docker-compose

Add read and write permissions

$ sudo chmod +x /usr/local/bin/docker-compose

see docker-compose edition

$ docker-compose version
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

docker-compose install tomcat

$ cd /usr/local/docker
 Create folder 
$ mkdir tomcat
 establish  docker-compose.yml
$ vim docker-compose.yml
 Paste as is 
:set paste

tomcat docker-compose.yml

version: '3.1'
services:
    tomcat:
        restart: always
        image: tomcat
        #  Image name 
        container_name: tomcat
        ports:
            - 8080:8080
        #  Data volume 
        volumes:
            - ./webapps:/usr/local/tomcat/webapps
        environment:
            TZ: Asia/Shanghai

start-up tomcat

 Solid state operation 
$ docker-compose up -d
 Stop running   Containers 
$ docker-compose down
 View the log of the container running   Containers id/ Container name 
$ docker logs -f id/name

docker-compose install mysql

mysql docker-compose.yml

version: '3.1'
services:
    db:
        restart: always
        image: mysql
        container_name: mysql
        environment:
            TZ: Asia/Shanghai
            MYSQL_ROOT_PASSWORD: 123456
        command:
        #    --default-anthentication-plugin=mysql_native_password
            --character-set-server=utf8mb4
            --collation-server=utf8mb4_general_ci
            --explicit_defaults_for_timestamp=true
        #    --lower_case_table_names=1
        ports:
            - 3306:3306
        volumes:
            - ./data:/var/lib/mysql
            - ./config:/etc/mysql/conf.d
            - ./log:/var/log/mysql

    # MySQL  Of  Web  client   PHP
    adminer:
        image: adminer
        restart: always
        ports:
            - 8081:8080

What needs to be noted here is --default-anthentication-plugin=mysql_native_password Parameters

Because I'm a virtual machine , I didn't use my own server to learn , So I've been stuck here for a long time and haven't found any problems , When I will command: All parameters are commented out and can be started and accessed normally , After testing, if you want to start normally --default-anthentication-plugin=mysql_native_password and --lower_case_table_names=1 Must be deleted at the same time , I haven't figured out the specific reason yet , Baidu has a lot of information , Including the official docker-compose.yml This parameter is set , But the strange thing is that I can't use , Headache

adminer It's a MySQL Of Web client , There's no problem with this. Just visit directly

docker-compose Installation and deployment GitLab

gitlab docker-compose.yml

Warm reminder : start-up gitlab Minimum need 4G Running memory

version: '3.1'
services:
    web:
        restart: always
        image: 'twang2218/gitlab-ce-zh'
        container_name: gitlab
        hostname: '192.168.226.128'
        environment:
            TZ: Asia/Shanghai
            GITLAB_OMNIBUS_CONFIG: |
                external_url 'http://192.168.226.128'
                gitlab_rails['gitlab_shell_ssh_port'] = 2222
                unicorn['port'] = 8888
                nginx['listen_port'] = 80
        ports:
            - '80:80'
            - '443:443'
            - '2222:22'
        volumes:
            - ./config:/etc/gitlab
            - ./data:/var/opt/gitlab
            - ./logs:/var/log/gitlab

start-up docker-compose This process takes a long time ......( Important things are to be repeated for 3 times ), Don't think you're wrong , Or simply because the server is too slow

You may also need a firewall to open the... Here 2222 port

$ firewall-cmd --zone=public --add-port=2222/tcp --permanent

The process is too long , Wait patiently . If you feel bored waiting , Let's take a look at the introduction of the image factory Library , And specific operations

DockerHub Address :https://hub.docker.com/r/twang2218/gitlab-ce-zh

balderdash :

After updating the blog , Talk about the slow update recently , Because the company is a little busy , But I learned a lot during this busy time , Find out nginx It's interesting , It used to be just a simple forwarding , I haven't actually learned these things , It involves something like CDN Forward these , It's true , I have time to update you , But let me learn Forgive me !

Go wandering , Always find someone who is willing to understand you in a corner of the world

Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .

版权声明
本文为[Shao Jie]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/08/20210809183600783h.html

Scroll to Top