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

Using /config instead of /conf in docker compose prevents start and ignores files in mapped /config volumes on :latest tag #2777

Closed
ic-dev21 opened this issue Mar 29, 2023 · 7 comments

Comments

@ic-dev21
Copy link

ic-dev21 commented Mar 29, 2023

Docker compose as follows:

This works and allows my mosquitto.conf file to be read.

services:
 mosquitto:
    image: eclipse-mosquitto:2
    restart: unless-stopped
    container_name: mosquitto
    volumes:
      - /home/pian/docker/mosquitto/config:/mosquitto/config
      - /home/pian/docker/mosquitto/data:/mosquitto/data
      - /home/pian/docker/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001 

This fails to start.

services:
 mosquitto:
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    container_name: mosquitto
    volumes:
      - /home/pian/docker/mosquitto/config:/mosquitto/config
      - /home/pian/docker/mosquitto/data:/mosquitto/data
      - /home/pian/docker/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001 

This starts but ignores my mosquitto.conf as it is not properly mapped.

services:
 mosquitto:
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    container_name: mosquitto
    volumes:
      - /home/pian/docker/mosquitto/config:/mosquitto/conf
      - /home/pian/docker/mosquitto/data:/mosquitto/data
      - /home/pian/docker/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001 
@Daedaluz
Copy link
Contributor

this works without issues for me (just changed volume source paths).

services:
  mosquitto:
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    container_name: mosquitto
    volumes:
    - "${PWD}/config:/mosquitto/config:rw"
    - "${PWD}/data:/mosquitto/data:rw"
    - "${PWD}/log:/mosquitto/log:rw"
    ports:
    - 1883:1883
    - 9001:9001

$ docker compose up

[+] Running 1/1
 ✔ Container mosquitto  Recreated                                                                                                                                                                                                      0.3s 
Attaching to mosquitto
mosquitto  | 1680165129: mosquitto version 2.0.15 starting
mosquitto  | 1680165129: Config loaded from /mosquitto/config/mosquitto.conf.
mosquitto  | 1680165129: Opening ipv4 listen socket on port 1883.
mosquitto  | 1680165129: Opening ipv6 listen socket on port 1883.
mosquitto  | 1680165129: Opening websockets listen socket on port 9001.
mosquitto  | 1680165129: mosquitto version 2.0.15 running

try pulling the latest image, see if it helps.

@ic-dev21
Copy link
Author

this works without issues for me (just changed volume source paths).

services:
  mosquitto:
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    container_name: mosquitto
    volumes:
    - "${PWD}/config:/mosquitto/config:rw"
    - "${PWD}/data:/mosquitto/data:rw"
    - "${PWD}/log:/mosquitto/log:rw"
    ports:
    - 1883:1883
    - 9001:9001

$ docker compose up

[+] Running 1/1
 ✔ Container mosquitto  Recreated                                                                                                                                                                                                      0.3s 
Attaching to mosquitto
mosquitto  | 1680165129: mosquitto version 2.0.15 starting
mosquitto  | 1680165129: Config loaded from /mosquitto/config/mosquitto.conf.
mosquitto  | 1680165129: Opening ipv4 listen socket on port 1883.
mosquitto  | 1680165129: Opening ipv6 listen socket on port 1883.
mosquitto  | 1680165129: Opening websockets listen socket on port 9001.
mosquitto  | 1680165129: mosquitto version 2.0.15 running

try pulling the latest image, see if it helps.

Nope. This fails to start and restarts in a loop. You've written the exact scenario the issue is about. If I don't use the latest tag, it works.

Folder structure on the host in unchanged, only changing the version to latest causes this.

@Daedaluz
Copy link
Contributor

is there any logs to look at?

@Daedaluz
Copy link
Contributor

And it would probably be helpful to see the config

@ic-dev21
Copy link
Author

is there any logs to look at?

None. It doesn’t log anything as it never starts.

@ralight
Copy link
Contributor

ralight commented Apr 1, 2023

It might be helpful to mention the image id for :2 and :latest - I have 35a004f35c81 for both.

I used this docker-compose.yml:

services:
 mosquitto:
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    container_name: mosquitto
    volumes:
      - /home/roger/docker/mosquitto/config:/mosquitto/config
      - /home/roger/docker/mosquitto/data:/mosquitto/data
      - /home/roger/docker/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001

And this is /home/roger/docker/mosquitto/config/mosquitto.conf

listener 1883
allow_anonymous true

log_type all

And this is the log output, including connecting with a subscriber:

Starting mosquitto ... done
Attaching to mosquitto
mosquitto    | 1680340582: mosquitto version 2.0.15 starting
mosquitto    | 1680340582: Config loaded from /mosquitto/config/mosquitto.conf.
mosquitto    | 1680340582: Opening ipv4 listen socket on port 1883.
mosquitto    | 1680340582: Opening ipv6 listen socket on port 1883.
mosquitto    | 1680340582: mosquitto version 2.0.15 running
mosquitto    | 1680340587: New connection from 172.19.0.1:56666 on port 1883.
mosquitto    | 1680340587: New client connected from 172.19.0.1:56666 as auto-B0278999-7474-9E07-3446-B6463CBD1501 (p2, c1, k60).
mosquitto    | 1680340587: No will message specified.
mosquitto    | 1680340587: Sending CONNACK to auto-B0278999-7474-9E07-3446-B6463CBD1501 (0, 0)
mosquitto    | 1680340587: Received SUBSCRIBE from auto-B0278999-7474-9E07-3446-B6463CBD1501
mosquitto    | 1680340587:      $SYS/broker/uptime (QoS 0)
mosquitto    | 1680340587: auto-B0278999-7474-9E07-3446-B6463CBD1501 0 $SYS/broker/uptime
mosquitto    | 1680340587: Sending SUBACK to auto-B0278999-7474-9E07-3446-B6463CBD1501
mosquitto    | 1680340587: Sending PUBLISH to auto-B0278999-7474-9E07-3446-B6463CBD1501 (d0, q0, r1, m0, '$SYS/broker/uptime', ... (9 bytes))
mosquitto    | 1680340588: Received DISCONNECT from auto-B0278999-7474-9E07-3446-B6463CBD1501
mosquitto    | 1680340588: Client auto-B0278999-7474-9E07-3446-B6463CBD1501 disconnected.

I'm running on 64-bit Linux. Are you on a different platform? Could you please try to reproduce with this simple config file?

@ic-dev21
Copy link
Author

ic-dev21 commented Apr 2, 2023

I noticed the image is the same for both :2 and :latest.

Config is very similar to yours.

It started working back out of the blue when I re-deployed it with the latest tags, no change on my end.

@ic-dev21 ic-dev21 closed this as completed Apr 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants