Docker host hostname
Closed this issue · 1 comments
I don't know if this is an issue or intended behaviour.
I'd like an agent container to know the hostname of the docker host it's running on.
Then agents docker-entrypoint.sh as specified in Dockerfile.erb should be able to have a CMD line passed to it. I thought that I could pass the same idea, like $HOSTNAME
or something of the sort via https://hostname/go/admin/elastic_profiles
under Docker command
but it doesn't pass arg to ENTRYPOINT
infact it actually overwrites it and tried to start the container with $HOSTNAME
as command.
Should mention here I've built my own image from a fork of your repo and I'm exporting ${SWARM_NODE_HOSTNAME}
from $1
when it's passed in
The way the agents are brough up I can't seem to specify additional service
or run
options like --args
or env
. I can't even use -v
to mount a file from the host.
Again it'd be nice for the container to know which node it's on. The reason being that the container agent is building containers and has the docker client on it. It's connnecting through to the hosts docker daemon via tcp://
. It's fine if you have one worker and know the hostname. But if you have a few workers this has to be dynamic.
I've also tried querying the remote docker api but came up short.
Any ideas?
btw I should mention that this works manually with
docker run -it --rm agent_image:ver $HOSTNAME
as this is passed as arg
It's also not enough to add the whole start up line
/docker-entrypoint.sh $HOSTNAME
to the agent_profile as it looks for /docker-entrypoint.sh locally lol and not as pid1 for the container.
Can't even find where it's been placed on the gocd /go/api/agents/
side.