Start containers automatically

This commit is contained in:
Andras Kovacs 2024-01-31 15:16:36 +01:00
parent f1ca9ab7eb
commit 0583960995
2 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ version: '3.4'
services: services:
netbox: &netbox netbox: &netbox
image: ${IMAGE-netboxcommunity/netbox:latest} image: ${IMAGE-netboxcommunity/netbox:latest}
restart: unless-stopped
depends_on: depends_on:
postgres: postgres:
condition: service_healthy condition: service_healthy
@ -40,6 +41,7 @@ services:
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1" test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
postgres: postgres:
image: postgres:16-alpine image: postgres:16-alpine
restart: unless-stopped
env_file: env/postgres.env env_file: env/postgres.env
healthcheck: healthcheck:
test: "pg_isready -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER" ## $$ because of docker-compose test: "pg_isready -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER" ## $$ because of docker-compose
@ -48,6 +50,7 @@ services:
retries: 5 retries: 5
redis: &redis redis: &redis
image: redis:7-alpine image: redis:7-alpine
restart: unless-stopped
command: command:
- sh - sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env

View File

@ -2,6 +2,7 @@ version: '3.4'
services: services:
netbox: &netbox netbox: &netbox
image: docker.io/netboxcommunity/netbox:${VERSION-v3.7-2.8.0} image: docker.io/netboxcommunity/netbox:${VERSION-v3.7-2.8.0}
restart: unless-stopped
depends_on: depends_on:
- postgres - postgres
- redis - redis
@ -48,6 +49,7 @@ services:
# postgres # postgres
postgres: postgres:
image: docker.io/postgres:16-alpine image: docker.io/postgres:16-alpine
restart: unless-stopped
env_file: env/postgres.env env_file: env/postgres.env
volumes: volumes:
- netbox-postgres-data:/var/lib/postgresql/data - netbox-postgres-data:/var/lib/postgresql/data
@ -55,6 +57,7 @@ services:
# redis # redis
redis: redis:
image: docker.io/redis:7-alpine image: docker.io/redis:7-alpine
restart: unless-stopped
command: command:
- sh - sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env
@ -64,6 +67,7 @@ services:
- netbox-redis-data:/data - netbox-redis-data:/data
redis-cache: redis-cache:
image: docker.io/redis:7-alpine image: docker.io/redis:7-alpine
restart: unless-stopped
command: command:
- sh - sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env