Есть 2 контейнера
networks:
bridge1:
external:
name: internal_bridge
services:
some-service:
networks:
bridge1:
aliases:
- some-service-project1
FROM ruby:2.5-alpine
ADD . /app
WORKDIR /app
RUN bundle install
CMD ["bundle", "exec", "passenger", "start"]
version: '2'
services:
passenger:
build: ./
restart: always
#ports:
# - 3000:3000 (для дебага)
nginx:
image: nginx:mainline-alpine
restart: always
volumes:
#- ./nginx.conf:/etc/nginx/nginx.conf
- ./nginx-site.conf:/etc/nginx/conf.d/passenger.conf
#- /path/to/static/:/path/in/container/
proxy_pass http://passenger:3000;
mysql -uroot -hdb -proot -e "SHOW MASTER STATUS;" > /dev/null && echo "connection to db: ok" || echo "connection to db: failed" >&2
mysql -uroot -hdb_test -proot -e "SHOW MASTER STATUS;" > /dev/null && echo "connection to db_test: ok" || echo "connection to db_test: failed" >&2
docker-compose -f docker-compose-file.yaml run --rm -v '/home/user/test.sh:/test.sh' --entrypoint="bash" db /test.sh
services:
...
certbot:
image: certbot/certbot
volumes:
/etc/letsencrypt_docker:/etc/letsencrypt
command: ["renew"]
docker-compose run certbot certonly --web-root=/etc/letsencrypt/challenges -d domain
.server {
server_name some.domain;
...
location /.well-known/acme-challenge {
root /etc/letsencrypt_docker/challenges;
}
}
docker-compose -f /path/to/docker-compose.yml up certbot
NODE_SERVER_IP=${DOCKER_HOST_IP}
в секции args: для контейнера с nginx в docker-compose.yml
proxy_pass $node_upstream;
nginx/Dockerfile
: ARG NODE_SERVER_IP=127.0.0.1
\
): && echo "upstream node_upstream { server ${NODE_SERVER_IP}:3000; }" >> /etc/nginx/conf.d/upstream.conf