Skip to content

[Docker] Shell scripts are not copied in the run stage #56

@anhgelus

Description

@anhgelus

When I tried to deploy this PDS, I encounter this issue:

/bin/sh: 0: cannot open /init-keys.sh: No such file
 * ERROR: cocoon failed to start

Thus, I have checked in the image if these scripts are available.

[root@vps] /etc/init.d# docker run -d --name me --rm ghcr.io/haileyok/cocoon:0.8 sleep 30
0d46319b0376f9c2a7fd0e30b63954caf729dc5750400301356e9e908f02a9b7
[root@vps] /etc/init.d# docker exec -ti me sh
# ls
bin  boot  cocoon  data  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
# find -name *.sh
./etc/init.d/hwclock.sh
./etc/rc0.d/K01hwclock.sh
./etc/rc6.d/K01hwclock.sh
./etc/rcS.d/S01hwclock.sh
./usr/lib/init/vars.sh
./usr/share/debconf/confmodule.sh
./usr/share/dpkg/sh/dpkg-error.sh

They are not.

After looking inside the Dockerfile, it appears that these scripts are never copied in the run stage. I suggest adding after the last copy

COPY ./init-keys.sh /
COPY ./create-initial-invite.sh /

to fix the issue.

Btw, I'm not using the default docker-compose.yml.

My configuration

Configuration

I tried this on an Alpine Linux v3.23. I am not running PostgreSQL in a container, but it changes nothing here obviously.

[root@vps] /etc/init.d# ./cocoon start
 * Caching service dependencies ...                                 [ ok ]
/bin/sh: 0: cannot open /init-keys.sh: No such file
 * ERROR: cocoon failed to start
[root@vps] /etc/init.d#

Here are my OpenRC service script:

#!/sbin/openrc-run
supervisor=supervise-daemon

name="cocoon (docker)"
description=""

: ${cocoon_env_file="/etc/cocoon.env"}
: ${cocoon_image="ghcr.io/haileyok/cocoon:0.8"}
: ${cocoon_opts="-p 9001:8080 -v ./data:/data/cocoon -v ./keys/rotation.key:/keys/rotation.key:ro -v ./keys/jwk.key:/keys/jwk.key:ro --env-file $cocoon_env_file"}

command=/usr/bin/docker
directory="/var/lib/cocoon"
command_args="run $cocoon_opts --add-host host:172.17.0.1 --name cocoon --rm $cocoon_image"
command_user=root:root

logdir="/var/log/cocoon"
output_log="$logdir/access.log"
error_log="$logdir/error.log"

depend() {
	need net localmount
	after firewall
}

start_pre() {
	checkpath -m 750 -d -o cocoon "$logdir"
	checkpath -m 600 -f -o cocoon "$cocoon_env_file"
	checkpath -f -o cocoon "$output_log"
	checkpath -f -o cocoon "$error_log"

	docker run $cocoon_opts --name cocoon-keys --rm ghcr.io/haileyok/cocoon:0.8 "/bin/sh" "/init-keys.sh"
}

Healthchecks are missing, and I have chosen to do not add the create-initial-invite which also looks like to be missing.

PS: I don't know if tangled or github is preferred, so I decided to open it here because it seems to be more active.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions