OpenLiberty / OpenLiberty/ci.docker
Runtime container command as root
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 48
- Forks
- 60
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 3
Description
I am trying to create a "debug" version of the OpenLiberty container to facilitate various troubleshooting. One of the items is to enable SSH and then run it at startup so the container can be remotely accessed. However, I'm running into permission problems with the Liberty user (uid 1001) and am wondering if someone can assist.
My Dockerfile has the following:
FROM open-liberty:21.0.0.7-kernel-slim-java8-openj9
USER root
COPY sshd_config /etc/ssh/
RUN apt-get update && apt-get install openssh-server -y && echo "root:xxx" | chpasswd
EXPOSE 22
USER 1001
COPY debug.sh /opt/scripts
CMD "/opt/scripts/debug.sh"
The debug.sh script has the following:
#!/bin/bash
service ssh start
/opt/ol/wlp/bin/server run defaultServer
The image build succeeds but when running the container, the script command service ssh start fails:
mkdir: cannot create directory ‘/run/sshd’: Permission denied
Can anyone advise/recommend on how to solve the issue? I'm not sure if installing sudo and configuring 1001 with no-password sudo ability is the correct approach--or if there's entirely another option.
Thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Dockerfile and debug.sh shown in the issue, then inspect how the container runs as user 1001 and how service ssh start uses /run/sshd. Reproduce the permission error with the open-liberty:21.0.0.7-kernel-slim-java8-openj9 image. Done means an agreed way to start SSH alongside the Liberty server without the /run/sshd permission failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100