Here is command which I am firing.
env $(cat .env | grep ^[A-Z] | xargs) $(cat .override_env | grep ^[A-Z] | xargs) docker stack deploy -c docker-compose.yml -c docker-compose.override.yml test_services
Expectation is it should take all base configs from first compose file i.e docker-compose.yml and then environment specific config from second compose file i.e. docker-compose.override.yml
as per the documentation https://docs.docker.com/engine/reference/commandline/stack_deploy/
But when I ran this i get error as:
Error response from daemon: rpc error: code = 3 desc = ContainerSpec: image reference must be provided.
This means its not merging two docker compose files, and picking up just the second one.
FYI. If I run only with first docker compose then it works.
Here are both the files:
docker-compose.yml
version: '3.1'
services:
test1-service::
image: "${DOCKER_REGISTRY}${DOCKER_APP_PATH}${IMAGE_PATH}"
environment:
- XMX_VALUE=${XMX_VALUE}
- MAX_METASPACE_SIZE=${MAX_METASPACE_SIZE}
volumes:
- ${HOST_LOG_DIR}:${FILE_PATH}
deploy:
mode: replicated
replicas: 3
placement:
constraints: [node.role == worker]
resources:
limits:
memory: ${MEMORY_LIMIT}
reservations:
memory: 500M
update_config:
parallelism: 1
delay: 30s
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
ports:
- ${TEST_PORT}:${TEST_PORT}
docker-compose.override.yml
version: '3.1'
services:
test1-service:
environment:
- ${TEST1_PORT}=${TEST1_PORT}
ports:
- ${TEST1_PORT}=${TEST1_PORT}
I am expecting both TEST_PORT and TEST1_PORT should get added as port mapping.
But as I mentioned above the command ignores first docker compose, so throws error as image not found.
Thanks,
Sachin
Here is command which I am firing.
Expectation is it should take all base configs from first compose file i.e docker-compose.yml and then environment specific config from second compose file i.e. docker-compose.override.yml
as per the documentation https://docs.docker.com/engine/reference/commandline/stack_deploy/
But when I ran this i get error as:
Error response from daemon: rpc error: code = 3 desc = ContainerSpec: image reference must be provided.
This means its not merging two docker compose files, and picking up just the second one.
FYI. If I run only with first docker compose then it works.
Here are both the files:
docker-compose.yml
docker-compose.override.yml
I am expecting both TEST_PORT and TEST1_PORT should get added as port mapping.
But as I mentioned above the command ignores first docker compose, so throws error as image not found.
Thanks,
Sachin