I have found an awesome repo that uses docker-compose however I would like to use it Docker Cloud Stacks (I am a newbie).
What would I have to do to be able to swap it over?
docker-compose:
version: "2"
services:
mariadb:
image: wodby/mariadb:10.2-3.0.2
php:
# 1. Images with vanilla WordPress – wodby/wordpress:[WP_VERSION]-[PHP_VERSION]-[STABILITY_TAG].
image: wodby/wordpress:4-7.2-3.3.1
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
PHP_FPM_CLEAR_ENV: "no"
volumes:
- codebase:/var/www/html
nginx:
image: wodby/wordpress-nginx:4-1.13-3.0.2
environment:
NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
volumes:
- codebase:/var/www/html
depends_on:
- php
labels:
- 'traefik.backend=nginx'
- 'traefik.port=80'
- 'traefik.frontend.rule=Host:wp.docker.localhost'
varnish:
image: wodby/wordpress-varnish:4.1-2.3.1
depends_on:
- nginx
environment:
VARNISH_SECRET: secret
VARNISH_BACKEND_HOST: nginx
VARNISH_BACKEND_PORT: 80
labels:
- 'traefik.backend=varnish'
- 'traefik.port=6081'
- 'traefik.frontend.rule=Host:varnish.wp.docker.localhost'
redis:
image: wodby/redis:4.0-2.1.4
blackfire:
image: blackfire/blackfire
environment:
BLACKFIRE_SERVER_ID:
BLACKFIRE_SERVER_TOKEN:
mailhog:
image: mailhog/mailhog
labels:
- 'traefik.backend=mailhog'
- 'traefik.port=8025'
- 'traefik.frontend.rule=Host:mailhog.wp.docker.localhost'
portainer:
image: portainer/portainer
command: --no-auth -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- 'traefik.backend=portainer'
- 'traefik.port=9000'
- 'traefik.frontend.rule=Host:portainer.wp.docker.localhost'
traefik:
image: traefik
command: -c /dev/null --web --docker --logLevel=INFO
ports:
- '8000:80'
# - '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
volumes:
codebase:
Related
This is my docker containers list of ports when running:
443/tcp
0.0.0.0:59541
59541/tcp
0.0.0.0:53620
59542/tcp
0.0.0.0:53621
80/tcp
0.0.0.0:59542
Is it possible to change the ones for 59541/tcp and 59542/tcp to 0.0.0.0:0?
This is my docker compose:
version: '3.4'
services:
appone.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
image: ${DOCKER_REGISTRY-}apponeapi
build:
context: .
dockerfile: AppONE.Api/Dockerfile
networks:
- ${NETWORK}
ports:
- "59541:443"
- "59542:80"
networks:
dev-network:
name: ${NETWORK}
This is the docker compose override:
version: '3.4'
services:
appone.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
ports:
- "59541"
- "59542"
volumes:
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
I have set up the docker registry at DigitalOcean to deploy my django application.
I have installed the doctl and setup the API credentials.
If I run the command as:
doctl auth list
i can see my auth as the current one, which has the Read and Write permission.
But now, when I try to run the command as:
docker-compose -f docker-compose.staging.yml push
I get the error as:
ERROR: error parsing HTTP 400 response body: unexpected end of JSON
input: ""
Here's my docker-compose.staging.yml file:
version: '3.8'
services:
web:
build:
context: ./app
dockerfile: Dockerfile.prod
image: registry.digitalocean.com/pythonist-do:web
command: gunicorn Pythonist.wsgi:application --bind 0.0.0.0:8000
volumes:
- static_volume:/home/app/web/staticfiles
- media_volume:/home/app/web/mediafiles
expose:
- 8000
env_file:
- ./.env.staging
nginx-proxy:
container_name: nginx-proxy
build: nginx
image: registry.digitalocean.com/pythonist-do:nginx-proxy
restart: always
ports:
- 443:443
- 80:80
volumes:
- static_volume:/home/app/web/staticfiles
- media_volume:/home/app/web/mediafiles
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
- /var/run/docker.sock:/tmp/docker.sock:ro
depends_on:
- web
nginx-proxy-letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
env_file:
- ./.env.staging.proxy-companion
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
- acme:/etc/acme.sh
depends_on:
- nginx-proxy
volumes:
static_volume:
media_volume:
certs:
html:
vhost:
acme:
You need to change the image tag
Instead of
registry.digitalocean.com/registry-name:tag
use this
registry.digitalocean.com/registry-name/image-name:tag
Good day!
I get error, when running the "docker-compose up" command
Full error:
ERROR: Volume /home/<...>/docker/telegraf.conf:/etc/telegraf/telegraf.conf:ro has incorrect format, should be external:internal[:mode]
I tried it:
Change the value of the docker version in Docker-compose.yml on 20.10.8 and 20. I get a version error
Put ./telegraf. conf:/etc/telegraf/telegraf. conf:ro in quotation marks ("/telegraf. conf:/etc/telegraf/telegraf. conf:ro in quotation marks"). I get the same error
Delete ":ro" from /telegraf. conf: / etc/telegraf/telegraf. conf:ro. Starts loading containers, but returns an error in the "telegraf" block
My OS: Ubuntu Mate (distro Ubuntu 20.04.3 LTS)
Docker version 20.10.8, build 3967b7d
Docker-compose version 1.29.2, build 5becea4c
Please tell me how to fix/bypass the error so that all the components are loaded
Docker-compose.yml:
# docker-compose up
version: "2"
services:
postgres:
environment:
- POSTGRES_DB=goby_test
- POSTGRES_USER=postgres
- POSTGRES_HOST_AUTH_METHOD=trust
- PGDATA=/data/postgres
image: "postgres:9.6.23-alpine"
mem_limit: 128M
cpus: 0.1
ports:
- 5432:5432
healthcheck:
test: "pg_isready --username=postgres && psql --username=postgres --list"
timeout: 10s
retries: 20
influxdb:
image: influxdb:1.8-alpine
platform: linux/x86_64
mem_limit: 1024M
cpus: 0.5
ports:
- 8086:8086
environment:
- INFLUXDB_DB=influx
- INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=admin
volumes:
- ./influxdb/scripts:/docker-entrypoint-initdb.d
# - influxdb_data:/var/lib/influxdb
telegraf:
image: telegraf:1.19.2-alpine
container_name: telegraf
platform: linux/x86_64
mem_limit: 128M
depends_on:
- influxdb
links:
- influxdb
ports:
- "8125:8125/udp"
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
grafana:
image: grafana/grafana:8.1.1
platform: linux/x86_64
mem_limit: 128M
ports:
- 3001:3000
links:
- influxdb
environment:
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_BASIC_ENABLED=false
depends_on:
- influxdb
volumes:
# - grafana_data:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
- ./grafana/dashboards/:/var/lib/grafana/dashboards/
web:
environment:
- POSTGRES_HOST=postgres
image: gobylang/todo-sample:latest
links:
- postgres
depends_on:
postgres:
condition: service_healthy
ports:
- 3000:3000
- "52022:22"
mem_limit: 64M
cpus: 0.1
entrypoint: goby server.gb --bind 0.0.0.0:3000 wsgi
tank:
image: direvius/yandex-tank
# image: ovil/ltws-tank
# environment:
# - COMPOSE_CONVERT_WINDOWS_PATHS=1
volumes:
- ../:/data
cap_add: [NET_ADMIN]
depends_on:
- web
- grafana
entrypoint: tail -f /dev/null
k6:
image: loadimpact/k6:0.33.0
ports:
- 6565:6565
environment:
- K6_OUT=influxdb=http://influxdb:8086/k6
# - COMPOSE_CONVERT_WINDOWS_PATHS=1
volumes:
- ../:/data
cap_add: [NET_ADMIN]
privileged: true
depends_on:
- web
- influxdb
- grafana
entrypoint: tail -f /dev/null
volumes:
grafana_data: {}
influxdb_data: {}
I have a service connecting to nsqd to produce and consume messages. I have integration tests connecting to it (broadcast address 127.0.0.1) and this works fine executing it locally in the cli or the ide.
Then I have created this service to up with docker-compose, but cannot connect to nsqd.
Following is my docker-compose file
version: '3'
services:
redis:
image: redis:4.0.9-alpine
ports:
- "6379:6379"
nsqlookupd:
image: nsqio/nsq:v0.3.8
command: /nsqlookupd
ports:
- "4160:4160"
- "4161:4161"
nsqd:
image: nsqio/nsq:v0.3.8
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160 --broadcast-address=127.0.0.1
links:
- nsqlookupd:nsqlookupd
ports:
- "4150:4150"
- "4151:4151"
nsqadmin:
image: nsqio/nsq:v0.3.8
ports:
- "4171:4171"
links:
- nsqlookupd:nsqlookupd
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
creator:
build: "creator/"
depends_on:
- nsqlookupd
- nsqd
- redis
environment:
SERVER_ADDR: ":8080"
NSQ_ADDR: "nsqd:4150"
NSQ_TOPIC: "driver_locations"
NSQ_CHANNEL: "ch"
REDIS: "redis:6379"
ports:
- "8080:8080"
Right now I don't care about the tests locally, just to have all the containers working properly.
I have tried changing the broadcast, removing the broadcast...
As they say in the docs https://nsq.io/deployment/docker.html#using-docker-compose this is the last thing I tried (basically the changes are the commands), with no luck:
version: '3'
services:
redis:
image: redis:4.0.9-alpine
ports:
- "6379:6379"
nsqlookupd:
image: nsqio/nsq
command: /nsqlookupd
ports:
- "4160"
- "4161"
nsqd:
image: nsqio/nsq
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160
depends_on:
- nsqlookupd
ports:
- "4150"
- "4151"
nsqadmin:
image: nsqio/nsq
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
depends_on:
- nsqlookupd
ports:
- "4171"
creator:
build: "creator/"
depends_on:
- nsqlookupd
- nsqd
- redis
environment:
SERVER_ADDR: ":8080"
NSQ_ADDR: "nsqd:4150"
NSQ_TOPIC: "driver_locations"
NSQ_CHANNEL: "ch"
REDIS: "redis:6379"
ports:
- "8080:8080"
Cache problem, sorry for that :facepalm:
What I told it wasn't working (removing the broadcast) IT IS
I have tried changing the broadcast, removing the broadcast...
As they say in the docs https://nsq.io/deployment/docker.html#using-docker-compose this is the last thing I tried (basically the changes are the commands), with no luck:
version: '3'
services:
redis:
image: redis:4.0.9-alpine
ports:
- "6379:6379"
nsqlookupd:
image: nsqio/nsq
command: /nsqlookupd
ports:
- "4160"
- "4161"
nsqd:
image: nsqio/nsq
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160
depends_on:
- nsqlookupd
ports:
- "4150"
- "4151"
nsqadmin:
image: nsqio/nsq
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
depends_on:
- nsqlookupd
ports:
- "4171"
creator:
build: "creator/"
depends_on:
- nsqlookupd
- nsqd
- redis
environment:
SERVER_ADDR: ":8080"
NSQ_ADDR: "nsqd:4150"
NSQ_TOPIC: "driver_locations"
NSQ_CHANNEL: "ch"
REDIS: "redis:6379"
ports:
- "8080:8080"
My docker-compose.yml looks like the below. When i run docker-compose up I get the below error.
ERROR: In file './docker-compose.yml', the service name True must be a quoted string, i.e. 'True'.
version: '3'
services:
db:
restart: always
image: postgres:9.6-alpine
container_name: pleroma_postgres
networks:
- pleroma
volumes:
- ./postgres:/var/lib/postgresql/data
web:
build: .
image: pleroma
container_name: pleroma_web
restart: always
environment:
- VIRTUAL_HOST=<myplaceholderhost>
- VIRTUAL_PORT=4000
- LETSENCRYPT_HOST=<myplaceholderhost>
- LETENCRYPT_EMAIL=<myplaceholderemail>
expose:
- "4000"
volumes:
- ./uploads:/pleroma/uploads
depends_on:
- db
nginx:
image: jwilder/nginx-proxy
container_name: nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker-articles/nginx/certs:/etc/nginx/certs:ro
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
restart: always
ports:
- "80:80"
- "443:443"
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
networks:
- pleroma
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.5
container_name: letsencrypt
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker/articles/nginx/certs:/etc/nginx/certs:rw
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
networks:
pleroma:
My docker version is
Docker version 18.06.1-ce, build e68fc7a
My docker compose version is
docker-compose version 1.23.1, build b02f1306
Running CoreOS version 1911.3.0
I ended up resolving this issue by modifying the nginx and letsencrypt portions of my docker-compose.yml file to be as follows.
nginx:
image: jwilder/nginx-proxy
container_name: nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker-articles/nginx/certs:/etc/nginx/certs:ro
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
restart: always
ports:
- "80:80"
- "443:443"
labels:
- "NGINX_PROXY_CONTAINER=true"
networks:
- pleroma
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.5
container_name: letsencrypt
environment:
- NGINX_PROXY_CONTAINER=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker/articles/nginx/certs:/etc/nginx/certs:rw
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
It seems "volumes_from" is deprecated in docker-compose v3. As well as I had forgotted quotes around my label and needed to set my environment within letsencrypt.
in CentOS env your .yml file directory must be /usr/local/bin