Preface This article will share some docker-compose configurations. You can refer to them to summarize your own set of docker-based development/production environment configurations. Let’s take a look at the detailed introduction. Install docker and docker-compose install docker curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun install docker-compose sudo curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose Create a dedicated network Use docker network to create your own dedicated common network me_gateway so that docker software can access each other docker network create me_gateway docker-compose deploy traefik
docker-compose.yml This is an example docker-compose.yml configuration using traefik Among them, the mounted ./traefik.toml is its configuration. The mounted acme.json is the configuration of Let's Encrypt version: '3' version: '3' services: me_traefik: image: traefik:1.7.4 container_name: me_traefik ports: - '80:80' - '443:443' - '8090:8090' volumes: - /var/run/docker.sock:/var/run/docker.sock - ./traefik.toml:/traefik.toml - ./acme.json:/acme.json networks: - webgateway networks: webgateway: external: name: me_gateway traefik.toml Detailed configuration description: http://docs.traefik.cn/toml#acme-lets-encrypt-configuration The following is an example. If you encounter some problems when configuring verification, you can refer to the following configuration or the comments of this article ################################################################ # Global configuration ################################################################ # Enable debug mode # # Optional # Default: false # debug = false # Log level # # Optional # Default: "ERROR" # logLevel = "ERROR" # Entrypoints to be used by frontends that do not specify any entrypoint. # Each frontend can specify its own entrypoints. # # Optional # Default: ["http"] # defaultEntryPoints = ["http","https"] ################################################################ # Entrypoints configuration ################################################################ # Entrypoints definition # # Optional # Default: # To enable basic auth for an entry point # Use 2 sets of username/password: test:test and test2:test2 # Passwords can be encrypted with MD5, SHA1 or BCrypt: You can use htpasswd to generate these usernames and passwords. # [entryPoints] # [entryPoints.http] # address = ":80" # [entryPoints.http.auth.basic] # users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] # # To enable digest auth for an entry point # Use 2 sets of username/domain/password: test:traefik:test and test2:traefik:test2 # You can use htdigest to generate these username/domain/password [entryPoints] [entryPoints.http] address = ":80" #[entryPoints.http.redirect] #entryPoint = "https" [entryPoints.https] address = ":443" [entryPoints.https.tls] [entryPoints.webentry] address = ":8090" [entryPoints.webentry.auth] [entryPoints.webentry.auth.basic] users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"] ################################################################ # API and dashboard configuration ################################################################ # Enable API and dashboard [api] dashboard = true entrypoint = "webentry" ################################################################ # Ping configuration ################################################################ # Enable ping [ping] # Name of the related entry point # # Optional # Default: "traefik" # # entryPoint = "traefik" ################################################################ # Docker backend configuration##################################################################### # Use the default domain name. # Can be overridden by setting the "traefik.domain" label for the container. # Enable Docker backend configuration [docker] endpoint = "unix:///var/run/docker.sock" domain = "yimo.link" watch = true exposedByDefault = false usebindportip = true swarmMode = false network = "me_gateway" [acme] email = "[email protected]" storage = "acme.json" entryPoint = "https" onDemand = false onHostRule = true [acme.httpChallenge] entryPoint="http" docker-compose deploys Gogs and uses traefik to bind the domain name If you want to build with mysql, you can refer to this configuration docker-compose.yml version: '3' services: me_gogs: restart: always image: gogs/gogs container_name: me_gogs volumes: - ./data:/data - ./logs:/app/gogs/log ports: - '10022:22' - '10080:3000' labels: - 'traefik.backend=me_gogs' - 'traefik.frontend.rule=Host:git.yimo.link' - 'traefik.enable=true' - 'traefik.protocol=http' - 'traefik.port=3000' networks: - webgateway networks: webgateway: external: name: me_gateway During initialization, you need to set the domain name to 0.0.0.0 or git.yimo.link That is, the ./data/gogs/conf/app.ini item is DOMAIN = git.yimo.link docker-compose deploy mysql It is worth noting that under the same network, you can directly use me_mysql to connect docker-compose.yml version: '3' services: me_mysql: image:mysql:5.7.21 container_name: me_mysql volumes: - ./data:/var/lib/mysql ports: - '3306:3306' environment: -MYSQL_ROOT_PASSWORD=root networks: - webgateway networks: webgateway: external: name: me_gateway Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: CentOS7 uses rpm package to install mysql 5.7.18
>>: JavaScript implements countdown on front-end web page
Preface Js is the most commonly used code manipul...
Preface The company's Ubuntu server places th...
1. Introduction to Prometheus Prometheus is an op...
This article shares with you a detailed tutorial ...
The MySQL built on Tencent Cloud is always very s...
RocketMQ is a distributed, queue-based messaging ...
Detailed explanation of Linux vi command The vi e...
Table of contents 1. Aggregate Query 1. COUNT fun...
Table of contents origin Virtual Memory Paging an...
Table of contents 1. Modify the app.vue page 2. C...
Copy code The code is as follows: <head> &l...
This article uses vue, and adds mouse click event...
1. Introduction tr is used to convert or delete a...
MySQL is a relational database management system ...
This article shares the specific code of vue+echa...