In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to use docker-compose to deploy software in linux, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
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-composesudo chmod + x / usr/local/bin/docker-compose
Create a private network
Use docker network to create your own private common network me_gateway, so that docker software can access each other
Docker network create me_gateway
Docker-compose deployment Traefik
A reverse proxy server, it is very fast, with automatic discovery service, automatic application https and other great features, project address, Chinese documents.
Docker-compose.yml
This is an example of a docker-compose.yml configuration using traefik
Among them, the mounted. / traefik.toml is configured for it
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: -' 80me_traefik 80'-'443image 803' -' 8090me_traefik 8090' volumes:-/ var/run/docker.sock:/var/run/docker.sock -. / traefik.toml:/traefik.toml -. / acme.json:/acme.json networks:-webgatewaynetworks: webgateway: external: name: me_gateway
Traefik.toml
Configuration details: http://docs.traefik.cn/toml#acme-lets-encrypt-configuration
The following is an example of some problems encountered during configuration verification. Please refer to the following configuration or the comments in 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 authentication (basic auth) for an entry point # use 2 groups of usernames / passwords: test:test and test2:test2# passwords can be MD5, SHA1 or BCrypt encryption: 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 authentication (digest auth) for an entry point # use two sets of usernames / domains / passwords: test:traefik:test and test2:traefik:test2# you can use htdigest to generate these usernames / domains / passwords [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 = trueentrypoint = "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 "traefik.domain" label for the container. # enable Docker backend configuration [docker] endpoint = "unix:///var/run/docker.sock" domain = "yimo.link" watch = trueexposedByDefault = falseusebindportip = trueswarmMode = falsenetwork = "me_gateway" [acme] email = "yimo666666@qq.com" storage = "acme.json" entryPoint= "https" onDemand = falseonHostRule = true [acme.httpChallenge] entryPoint= "http"
Docker-compose deploys Gogs and binds domain names using traefik
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 always image 22'- '10080 traefik.frontend.rule=Host:git.yimo.link' 3000' labels:-'traefik.backend=me_gogs' -' traefik.frontend.rule=Host:git.yimo.link'-'traefik.enable=true' -' traefik.protocol=http'-'traefik.port=3000' Networks:-webgatewaynetworks: webgateway: external: name: me_gateway
The domain name needs to be set to 0.0.0.0 or git.yimo.link during initialization.
That is, the. / data/gogs/conf/app.ini entry is
DOMAIN = git.yimo.link
Docker-compose deployment mysql
What is worth explaining is that under the same network, you can use me_mysql to connect directly.
Docker-compose.yml
Version: '3'services: me_mysql: image: mysql:5.7.21 container_name: me_mysql volumes: -. / data:/var/lib/mysql ports: -' 3306me_mysql 3306' environment:-MYSQL_ROOT_PASSWORD=root networks:-webgatewaynetworks: webgateway: external: name: me_gateway the above is how to deploy software in linux using docker-compose. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Nova service-list executes +-+
© 2024 shulou.com SLNews company. All rights reserved.