The image I am using is quay.io/artemiscloud/activemq-artemis-broker
.
In my docker-compose.yml
, I run the container with root user:
version: "3"
services:
artemis:
user: "root"
image: quay.io/artemiscloud/activemq-artemis-broker
environment:
AMQ_USER: admin
AMQ_PASSWORD: password
AMQ_RESET_CONFIG: true
volumes:
# mount local file to container path as a new file works well!
- ./config/my.json:/home/jboss/broker/etc/my.json
# mount local file to overwrite a file in container path fails!
- ./config/login.config:/home/jboss/broker/etc/login.config
ports:
- "5672:5672"
- "61616:61616"
- "8161:8161"
networks:
- backend
networks:
backend:
driver: bridge
Mounting local file as a new file in the container path /home/jboss/broker/etc/my.json
works well!
But mounting local file to overwrite an existing file in the same path fails with error:
2024-03-04 22:30:59 Exception in thread "main" java.io.FileNotFoundException: broker/etc/login.config (Permission denied)
What I have verified:
I have verified that there is /home/jboss/broker/etc/
directory inside the container (by default) and inside the path there is login.config
file which I try to overwrite:
[jboss@5905b996368e ~]$ pwd
/home/jboss
[jboss@5905b996368e ~]$ ls
broker
[jboss@5905b996368e ~]$ ls ./broker/etc/
... login.config
...
So, how can I mount my local file ./config/login.config
on host to overwrite the file in container path /home/jboss/broker/etc/login.config
??
A simple solution that works only for
loging.config
is to point the broker to a customloging.config
path by setting the system propertyava.security.auth.login.config
, i.e.A more generic solution requires to overwrite the container command, i.e.
Alternatively, you could pass a full broker instance when you need to overwrite instance files in the the /home/jboss/broker directory.