How can I use Docker Secrets while enabling the security_opt section for the same Docker container?
I managed to do this for two different containers - in the first Docker container I was able to load Docker Secrets, but I couldn’t enable security_opt. In the second Docker container I was able to enable security_opt, but I couldn’t load Docker Secrets.
The first container is launched with the command ‘docker stack deploy -c docker-swarm.yml my_test_stack’. The docker-swarm.yml file can be found on my GitHub ( details-of-the-question/docker-swarm.yml at main · sinus1-ground2-cosinus3-sky4/details-of-the-question · GitHub ).
The second container is launched with the command ‘docker compose -f docker-compose.yml up -d’. The docker-compose.yml file can be found on my GitHub ( details-of-the-question/docker-compose.yml at main · sinus1-ground2-cosinus3-sky4/details-of-the-question · GitHub ).
Testing is performed in the Docker context of the ‘default’ type using the socket ‘unix:///var/run/docker.sock’ as the ‘DOCKER ENDPOINT’.
The Dockerfile, /lib/systemd/system/docker.service, /home/USER_NAME/.docker/config.json, and the output of the ‘docker info’ command (docker_info.txt) can be found on my GitHub ( GitHub - sinus1-ground2-cosinus3-sky4/details-of-the-question ).
Ubuntu 24.04.2 LTS is used as the Host OS.
Alpine Linux 3.21.3 is used as the Container OS.
Versions used:
Docker version 28.1.1, build 4eba377
Docker Compose version v2.29.7-desktop.1