One of the containers in my swarm needs to use a specific runtime value (the equivalent of the —runtime argument in the Docker run command). Is there a way to specify this value in the docker-compose.yml file?
You can use docker configs. Something like this:
services: service-name: image: [image-name]:[tag] deploy: replicas: 2 configs: - my_config configs: my_config: file: ./my_config.txt
By default, the container can access the config from “/my_config”
Thanks for the suggestion. From what I can tell, this only exposes a file in the container’s file system which you can then use for configuration purposes. It doesn’t look like I would be able to set the container’s runtime. Just to clarify, in my compose file, I need to recreate something like this:
docker run --runtime=nvidia nvidia/cuda /bin/bash
Hey sanlabkevin, did you ever find out if this is possible? I haven’t been able to find any way to do this.