Docker isn't mounting my 2 volumes when I deploy the container using Salt. I am using the official Salt formula from SaltStack. (https://github.com/saltstack-formulas/docker-formula) I've written the following pillar which succesfully deploys the container to my minion, but the volume that contains the json file doesn't get mounted, and the single shared volume also isn't working. Docker is creating 2 seperate volumes, while they are supposed to just share 1 volume between the 2 containers, so they can exchange files.
docker:
containers:
running:
- op-connect-api
- op-connect-sync
op-connect-api:
image: "1password/connect-api:latest"
op-connect-sync:
image: "1password/connect-sync:latest"
compose:
op-connect-api:
hostname: "op-connect-api.domain.local"
ports: "8080:8080"
binds:
- "/home/kevinadmin/1password-credentials.json:/home/opuser/.op/1password-credentials.json"
- "data:/home/opuser/.op/data"
op-connect-sync:
hostname: "op-connect-sync.domain.local"
binds:
- /home/kevinadmin/1password-credentials.json:/home/opuser/.op/1password-credentials.json"
- data:/home/opuser/.op/data"
volumes:
data:
The json file has the following file settings:
-rwxrwxrwx 1 kevinadmin admin 1110 Aug 17 11:12 1password-credentials.json
I have also tried just creating the containers locally using a docker compose yaml file. When using the below file, my containers get deployed succesfully and the volumes are mounted.
version: "3.4"
services:
op-connect-api-test:
image: 1password/connect-api:latest
ports:
- "8081:8080"
volumes:
- "./1password-credentials.json:/home/opuser/.op/1password-credentials.json"
- "data:/home/opuser/.op/data"
op-connect-sync-test:
image: 1password/connect-sync:latest
volumes:
- "./1password-credentials.json:/home/opuser/.op/1password-credentials.json"
- "data:/home/opuser/.op/data"
volumes:
data:
I have tried checking the logs to see if I can find if something is going wrong with the mounting of the file/volume, but the log files looked great. I've checked
- journalctl -u docker
- /var/log/syslog
- docker logs {CONTAINER_ID}
- Local logs on the container itself
I am using
docker inspect {CONTAINER_ID}
to check if the volumes are mounted correctly, but when executing the command, I can see a new volume being created and mounted to the container.
Output of docker inspect when deploying a container via the docker-compose yaml file:
"Volumes": {
"/home/opuser/.op/1password-credentials.json": {},
"/home/opuser/.op/data": {}
},
Output of docker inspect when deploying a container via the salt pillar:
"Volumes": {
"/home/opuser/.op/data": {}
},