Align the credentials use_api_socket gives a service with what
`docker run --use-api-socket` does in the Docker CLI:
- the config file is created with mode 0600 instead of the 0444 default
of a config file, so that only the container's root reads it;
- a service which sets DOCKER_CONFIG itself gets the socket but no
credentials, as the comment of the function always said;
- nothing is injected, and DOCKER_CONFIG is not set, when the host has no
registry credentials, and they are not looked up when no service is to
get them.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
A container created beforehand and only started by `compose start`
(`create` then `start`, `up --no-start` then `start`, or a dependency named
to `start`) came up with DOCKER_CONFIG pointing at /run/secrets/docker and no
file there: use_api_socket is applied by rewriting the project, and the
config file it adds is injected when a container starts, from the project the
start works on. Create and run applied the rewriting, start did not.
start() now applies it too, on the copy it already makes of the project, so
the caller's is left alone, and a project already rewritten (a dependency
started by run) is not rewritten twice. The rewriting tolerates a project
without environment or configs maps, as the one `compose start` loads.
up -d, a foreground up, scale and run already provided the file.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>