New answers tagged


After some more time I found my answer. The service I wanted to deploy was a slightly different version of a service we already have. Stack file for the "original" service: version: '3.7' services: my-service: image: my-repo:port/company/my-service ports: - 81:81 networks: - my-network deploy: replicas: 1 restart_policy: ...


You just have to use the hostname on your docker compose file like this: hostname: whatever-{{.Node.Hostname}} Note that you have to prepend something to the hostname to avoid hostnames duplicates.


There is stages in gitlab ci and on 'docker build' stage I don't need ALL env variables. Usually its only a REACT_APP_SERVER_URI variable. Later I use env file in compose.yml like you are. env_file: - ./envs/common.env


I ended up using {{.ManagerStatus.Addr}} and stripping the port number from the results with sed. for NODE in $(docker node ls -f 'role=manager' --format '{{.Hostname}}'); do docker node inspect --format '{{.ManagerStatus.Addr}}' ${NODE} | sed 's/:2377//' done

Top 50 recent answers are included