When linking services together, I am not able to specifically start a single service which is linked to another service because the other service is reported as undefined.
With an analog docker-compose, I don't experiment this behavior, see last section.
STEPS TO REPRODUCE
ansible-container init
# fill-up container.yml with file above
ansible-container build
ansible-container run # works fine
ansible-container restart source_link dest_link # also works fine
ansible-container restart source_link # fails
EXPECTED RESULTS
I expect the service to be restarted and either linked to the already running container, either to a new container.
ACTUAL RESULTS
The target service is reported as undefined.
# output truncated
The full traceback is:
File "/tmp/ansible_IXOxuw/ansible_module_docker_service.py", line 648, in __init__
self.project = project_from_options(self.project_src, self.options)
File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 41, in project_from_options
compatibility=options.get('--compatibility'),
File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 113, in get_project
config_data = config.load(config_details, compatibility)
File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 402, in load
service_dicts = load_services(config_details, main_file, compatibility)
File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 502, in load_services
return build_services(service_config)
File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 481, in build_services
for name, service_dict in service_config.items()
File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 467, in build_service
validate_service(service_config, service_names, config_file)
File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 705, in validate_service
validate_links(service_config, service_names)
File "/usr/lib/python2.7/site-packages/compose/config/validation.py", line 230, in validate_links
"undefined.".format(s=service_config, link=link))
fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"api_version": null,
"build": false,
"cacert_path": null,
"cert_path": null,
"debug": false,
"definition": {
"services": {
"source_link": {
"command": [
"sleep",
"1000"
],
"image": "alpine:3.5",
"links": [
"dest_link"
]
}
},
"version": "2"
},
"dependencies": true,
"docker_host": null,
"files": null,
"filter_logger": false,
"hostname_check": false,
"key_path": null,
"nocache": false,
"project_name": "link_alias",
"project_src": null,
"pull": false,
"recreate": "smart",
"remove_images": null,
"remove_orphans": false,
"remove_volumes": false,
"restarted": true,
"scale": null,
"services": null,
"ssl_version": null,
"state": "present",
"stopped": false,
"timeout": 10,
"tls": null,
"tls_hostname": null,
"tls_verify": null
}
},
"msg": "Configuration error - Service 'source_link' has a link to service 'dest_link' which is undefined."
}
WITH DOCKER-COMPOSE
I don't know if this is relevant, but check this analog docker-compose.yml :
ISSUE TYPE
container.yml
OS / ENVIRONMENT
SUMMARY
When linking services together, I am not able to specifically start a single service which is linked to another service because the other service is reported as undefined.
With an analog
docker-compose
, I don't experiment this behavior, see last section.STEPS TO REPRODUCE
EXPECTED RESULTS
I expect the service to be restarted and either linked to the already running container, either to a new container.
ACTUAL RESULTS
The target service is reported as undefined.
WITH DOCKER-COMPOSE
I don't know if this is relevant, but check this analog
docker-compose.yml
:When running the following analog commands :
All works fine.
Thank you for your time and please tell me if you need anything else.