Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit ce3b0d0

Browse files
committed
Use supervisord to allow clean exits of container
1 parent 8464370 commit ce3b0d0

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ ADD ./container /
1515
ADD ./LICENSE /
1616

1717
RUN set -euo pipefail && \
18-
dnf install -y cockpit-ws-${COCKPIT_VERSION} cockpit-bridge-${COCKPIT_VERSION} python3 openssh-clients && \
18+
dnf install -y supervisor cockpit-ws-${COCKPIT_VERSION} cockpit-bridge-${COCKPIT_VERSION} python3 openssh-clients && \
1919
dnf clean all && \
2020
echo "NAME=default\nID=default" > /etc/os-release && \
2121
chmod 755 /usr/local/bin/*
2222

2323
ENV COCKPIT_SSH_KEY_PATH /etc/cockpit/identity
2424

25-
CMD ["/usr/local/bin/start"]
25+
ENTRYPOINT [ "/usr/bin/supervisord", "-c", "/etc/supervisord.conf" ]

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,18 @@ You can also specify the `known_hosts` file Cockpit will use to check fingerprin
8686
The default template for the `cockpit.conf` only allows username and password authentication.
8787

8888
However, the image comes pre-packaged with an
89-
[utility](https://github.com/realk1ko/cockpit-container/blob/main/container/usr/local/bin/cockpit-auth-ssh-key) created
90-
by
91-
the [Cockpit Project Team](https://github.com/cockpit-project) that allows you to use a **single** specific SSH key as
92-
identity for Cockpit when connecting to managed hosts.
89+
[utility](https://github.com/realk1ko/cockpit-container/blob/main/container/usr/local/libexec/cockpit-auth-ssh-key)
90+
created by the [Cockpit Project Team](https://github.com/cockpit-project) that allows you to use a **single** specific
91+
SSH key as identity for Cockpit when connecting to managed hosts.
9392

9493
To use key authentication you will need to append the following lines to the `cockpit.conf` file:
9594

9695
```
9796
[Basic]
98-
Command = /usr/local/bin/cockpit-auth-ssh-key
97+
Command = /usr/local/libexec/cockpit-auth-ssh-key
9998
10099
[Ssh-Login]
101-
Command = /usr/local/bin/cockpit-auth-ssh-key
100+
Command = /usr/local/libexec/cockpit-auth-ssh-key
102101
```
103102

104103
Per default the container will use the key stored at `/etc/cockpit/identity`, if it exists. You can provide such a file

container/etc/supervisord.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[supervisord]
2+
nodaemon=true
3+
pidfile=/tmp/supervisord.pid
4+
logfile=/dev/fd/1
5+
logfile_maxbytes=0
6+
user=root
7+
group=root
8+
9+
[program:ssh-agent]
10+
priority=0
11+
command=/usr/bin/ssh-agent -D -a /tmp/ssh-agent.sock
12+
autorestart=true
13+
user=root
14+
group=root
15+
16+
[program:cockpit-start]
17+
priority=1
18+
environment=SSH_AUTH_SOCK=/tmp/ssh-agent.sock
19+
command=/usr/local/bin/cockpit-start
20+
autorestart=true
21+
user=root
22+
group=root

container/usr/local/bin/start renamed to container/usr/local/bin/cockpit-start

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,5 @@ set -euo pipefail
1111
# create default configuration file if it does not exist
1212
[[ -f /etc/cockpit/cockpit.conf ]] || cp /usr/local/etc/cockpit-container/cockpit.conf.template /etc/cockpit/cockpit.conf
1313

14-
# startup of ssh-agent
15-
eval $(ssh-agent -s)
16-
1714
# startup of cockpit
1815
exec /usr/libexec/cockpit-ws --local-ssh
File renamed without changes.

0 commit comments

Comments
 (0)