Giter Club home page Giter Club logo

Comments (5)

ketan avatar ketan commented on September 21, 2024

I'd probably try adding scripts in /docker-entrypoint.d and see if that works as expected? See

yell "Running custom scripts in /docker-entrypoint.d/ ..."
# to prevent expansion to literal string `/docker-entrypoint.d/*` when there is nothing matching the glob
shopt -s nullglob
for file in /docker-entrypoint.d/*; do
if [ -f "$file" ] && [ -x "$file" ]; then
try "$file"
else
yell "Ignoring $file, it is either not a file or is not executable"
fi
done

from docker-gocd-agent.

MPV avatar MPV commented on September 21, 2024

Oh maybe I've interpreted it wrong... I thought /docker-entrypoint.d was only run as root?

I want my scripts to be run as the go user (to be set for pipeline jobs).

I thought this line made it run /goagent/agent.sh as the go user, using gosu:

try exec /usr/local/sbin/tini -- /usr/local/sbin/gosu go "$0" "$@"

...but maybe it's running itself again and thus loading /docker-entrypoint.d/ files, also as go?

from docker-gocd-agent.

MPV avatar MPV commented on September 21, 2024

This is what led me to configure the /etc/default/go-agent file from before:

Users can override default startup arguments for a GoCD agent in a Linux machine by editing the file etc/default/go-agent.

https://docs.gocd.org/current/installation/install/agent/linux.html#overriding-default-startup-arguments-and-environment

from docker-gocd-agent.

MPV avatar MPV commented on September 21, 2024

@ketan Looking at the logs of my container, I see this happening during startup:

/docker-entrypoint.sh: Creating directories and symlinks to hold GoCD configuration, data, and logs
[...]
$ chown go:go /go/config/autoregister.properties
/docker-entrypoint.sh: Running custom scripts in /docker-entrypoint.d/ ...
$ exec /usr/local/sbin/tini -- /usr/local/sbin/gosu go /docker-entrypoint.sh /go-agent/agent.sh
/docker-entrypoint.sh: line 57: /usr/local/bin/nohup.out: Permission denied
$ exec /go-agent/agent.sh
[Thu Sep 06 11:18:35 GMT 2018] Starting process:
[...]

...thus it doesn't seem like it runs those files in /docker-entrypoint.d as go, but only as root?

Any suggestions of what I could try?

from docker-gocd-agent.

ketan avatar ketan commented on September 21, 2024

@MPV

Here's how things have been designed:

  • Stuff in /docker-entrypoint.d executes as root user, intentionally so. Use this to provision, install packages etc.
  • Stuff in /etc/default/go-agent is sourced from the agent startup script (/goagent/agent.sh). Use this to ensure that variables are available to the agent process (which runs as the go user). This file can be volume mounted (or baked into the image, as the case may be).

from docker-gocd-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.