Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80 #50

Closed
Akirainblack opened this issue Dec 29, 2022 · 20 comments
Labels
bug Something isn't working help wanted Extra attention is needed setup problems

Comments

@Akirainblack
Copy link

Akirainblack commented Dec 29, 2022

My docker compose snippet for bar assistant:

  bar-assistant:
    image: kmikus12/bar-assistant-server:v1.0.4
    container_name: bar-assistant
    depends_on:
      - meilisearch
      - meili-redis
    environment:
      - APP_URL=http://<IP Address>:8900
      - MEILISEARCH_KEY=<$MEILI_MASTER_KEY>
      - MEILISEARCH_HOST=http://<IP Adddress>:7700
      - REDIS_HOST=redis
    restart: unless-stopped
    volumes:
      - /volume2/docker/bar/ba:/var/www/cocktails/storage
    ports:
      - 8900:80

Log:

AH00015: Unable to open logs
Updating search index settings...
Syncing cocktails and ingredients to meilisearch...
Adding routes and config to cache...
   INFO  Configuration cached successfully.  
   INFO  Routes cached successfully.  
Application ready!
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

Please can you advise where I've gone wrong? Tried both 1.0.5 and 1.0.4

@karlomikus
Copy link
Owner

Possibly related to #12

Try switching to named volumes, change the following:

- /volume2/docker/bar/ba:/var/www/cocktails/storage

to

- ba-storage:/var/www/cocktails/storage

And add the following at the end of the file

volumes:
  ba-storage:

You can refrence the following compose file: https://github.com/bar-assistant/docker/blob/master/docker-compose.yml

@Akirainblack
Copy link
Author

Akirainblack commented Dec 30, 2022

That's not the problem.. The container is running so all folder mappings are there and happy. It's not able to bind port 80.
Absolutely nothing to do with #12... That is a folder permission issue.

@karlomikus
Copy link
Owner

Since this is not your whole compose file, do you have only bar assistant services in it or any other. Maybe something else is already listening on the port 80.

@Akirainblack
Copy link
Author

As per the ports section of my compose:
ports:
- 8900:80
It shouldn't be trying to bind to port 80

@zhdenny
Copy link

zhdenny commented Dec 30, 2022

If I remember, I might have had this exact same problem until I did what the developer suggests regarding using named storages. Did you actually try that? I know it doesn't sound related, but give it a shot.

@Akirainblack
Copy link
Author

Tried this, however no different.
:(

@Akirainblack
Copy link
Author

Had to add:
user: 0:0

before it would work. Not happy with it as a solution though as that's now running as root.

@karlomikus
Copy link
Owner

Yeah, that should not be needed to run.
On what hardware are you running this? I have an instance on my RPI3, desktop PCs and a server and everything is working fine.

@Akirainblack
Copy link
Author

Akirainblack commented Jan 3, 2023

A synology NAS. DS918+ to be precise
Of note with everything as it stands in my compose it works perfectly, builds the database, imports the ingredients etc all the way up until it tries to bind the port as per the original log above. It only works from there on if I add "user: 0:0" to the compose.
Docker version 20.10.3, build 55f0773
Docker Compose version v2.14.2
I'm running a multitude of other containers which don't have this problem, I'm also modifying the ports some of them use.

@Akirainblack
Copy link
Author

Any update on this, please?

@karlomikus
Copy link
Owner

I can't do much without successfully recreating that error locally.

Can you share your minimal docker compose file that creates this error.

@Akirainblack
Copy link
Author

Akirainblack commented Jan 17, 2023

version: "3"

services:
  # Setup Meilisearch instance
  meilisearch:
    container_name: meilisearch
    image: getmeili/meilisearch:v0.29
    environment:
      - MEILI_MASTER_KEY=$MEILI_MASTER_KEY
      - MEILI_ENV=production
    restart: unless-stopped
    ports:
      - 7700:7700
    volumes:
      - /volume2/docker/bar/meili:/meili_data
    networks:
      - bar
  # Redis for session and file cache
  meili-redis:
    image: redis
    container_name: meili-redis
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    restart: unless-stopped
    networks:
      - bar
  # Bar Assistant API
  bar-assistant:
    image: kmikus12/bar-assistant-server
    container_name: bar-assistant
    user: 0:0
    depends_on:
      - meilisearch
      - meili-redis
    environment:
      - APP_URL=$BAR_URL
      - MEILISEARCH_KEY=$MEILI_MASTER_KEY
      - MEILISEARCH_HOST=$MEILI_HOST
      - REDIS_HOST=redis
      - ALLOW_REGISTRATION=false
    restart: unless-stopped
    volumes:
      - /volume2/docker/bar/ba:/var/www/cocktails/storage
    ports:
      - 8900:80
    networks:
      - bar
  # Bar Assistant Client
  salt-rim:
    image: kmikus12/salt-rim
    container_name: salt-rim
    depends_on:
      - meilisearch
      - bar-assistant
    environment:
      - API_URL=$API_URL
    restart: unless-stopped
    ports:
      - 8980:8080
    networks:
      - bar
##NETWORKS
networks:
    bar:
        external: true

@karlomikus
Copy link
Owner

Here's my modified version of your compose file that works for me:

version: "3"

services:
  # Setup Meilisearch instance
  meilisearch:
    container_name: meilisearch
    image: getmeili/meilisearch:v0.29
    environment:
      - MEILI_MASTER_KEY=masterKey
      - MEILI_ENV=production
    restart: unless-stopped
    ports:
      - 7778:7700
    volumes:
      - ./meili:/meili_data
    networks:
      - bar
  # Redis for session and file cache
  meili-redis:
    image: redis
    container_name: meili-redis
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    restart: unless-stopped
    networks:
      - bar
  # Bar Assistant API
  bar-assistant:
    image: kmikus12/bar-assistant-server
    container_name: bar-assistant
    # user: 0:0
    depends_on:
      - meilisearch
      - meili-redis
    environment:
      - APP_URL=http://localhost:8900
      - MEILISEARCH_KEY=masterKey
      - MEILISEARCH_HOST=http://localhost:7778
      - REDIS_HOST=redis
      - ALLOW_REGISTRATION=false
    restart: unless-stopped
    volumes:
      - ./ba:/var/www/cocktails/storage
    ports:
      - 8900:80
    networks:
      - bar
  # Bar Assistant Client
  salt-rim:
    image: kmikus12/salt-rim
    container_name: salt-rim
    depends_on:
      - meilisearch
      - bar-assistant
    environment:
      - API_URL=http://localhost:8900
    restart: unless-stopped
    ports:
      - 8980:8080
    networks:
      - bar
##NETWORKS
networks:
  bar:
    external: true

You probably have some specific server configuration, like maybe you are running docker in rootless mode, but you need root privileges to bind port 80.
I'm not sure, but you don't have to necessarily use user: 0:0, you could create a new user that is in a docker group and use his GID and UID.
Otherwise I can't help you much, you could maybe test it on another hardware or on your local pc and see if it works there.

@Akirainblack
Copy link
Author

Akirainblack commented Jan 17, 2023

If I try to do anything other than root I get the following in bar-assistant:
Application .env file not found, creating a new .env file...
cp: cannot create regular file '.env': Permission denied
Why bind to 80 if it requires root, why not do something similar to salt-rim with bar-assistant and bind to a non root port?

@zhdenny
Copy link

zhdenny commented Jan 17, 2023

I have a feeling this has to do with Docker restrictions related to the synology OS. Just a guess, but I know Synology OS has a specific treatment of Docker

@karlomikus
Copy link
Owner

If I try to do anything other than root I get the following in bar-assistant:
Application .env file not found, creating a new .env file...
cp: cannot create regular file '.env': Permission denied
Why bind to 80 if it requires root, why not do something similar to salt-rim with bar-assistant and bind to a non root port?

Yes, that issue is related to #12 , you need to use named volumes to fix that.

Port 80 is http port and is by default used by php-apache docker image. I have plans to refactor docker image to php-fpm and I will then change the main port, but I have no idea when will that be released.

You could also fork the repository and build your own image with the changed port and see if that helps.

@Akirainblack
Copy link
Author

I get the same error with the named volumes even when using anything but a root account.

@zhdenny
Copy link

zhdenny commented Jan 18, 2023

Do you have a vanilla Linux build you can test on? I still think this all just has to do with Synology being weird.

@Akirainblack
Copy link
Author

I accept the fact that it's a Synology isn't likely to be helping, however on the grounds that I'm running 70 other containers, including linuxserver/swag (which uses port 80 and 443) and have run a plethora of other containers. I can't believe it's just down to it being Synology.

@karlomikus karlomikus added bug Something isn't working help wanted Extra attention is needed setup problems labels Jan 29, 2023
@karlomikus
Copy link
Owner

New docker improvements are now available as a release candidate.
I welcome you to try the new setup, you can find the guide here.

If you are still having problems please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed setup problems
Projects
None yet
Development

No branches or pull requests

3 participants