Every time my container starts it goes into the exited state. When I inspect the container I see the error "address is already in use". To fix this I have to run docker-compose down and bring it up again. Is there a better solution because it should autostart the container.
Here is my docker-compose
version: '3.4'
services:
app:
image: test
container_name: test
environment:
driver: ${driver}
restart: unless-stopped
ports:
- "44379:443"
networks:
app-network:
ipv4_address: 172.22.0.6
healthcheck:
test: curl -sSk https://localhost:443/health || exit 1
interval: 10s
timeout: 15s
start_period: 60s
retries: 2
networks:
app-network:
ipam:
driver: default
config:
- subnet: 172.22.0.0/16
Nginx proxy on the machine
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/ssl/ssl_certificate.cer;
ssl_certificate_key /etc/sslprivate_key.key;
location / {
proxy_pass https://192.158.0.150:44379;
}
}
PS: I can manually clear the port but I am looking for a way so container can always auto starts without manually intervention