Fixed docker example sshd init

This commit is contained in:
Olof Hagsand 2022-12-12 09:49:05 +01:00
parent 61e2f014be
commit 7621b2f2f3
4 changed files with 28 additions and 9 deletions

View file

@ -93,15 +93,19 @@ RUN apk add --update flex bison
# need to add www user manually # need to add www user manually
RUN adduser -D -H -G www-data www-data RUN adduser -D -H -G www-data www-data
RUN apk add --update openssl # openssl and nghttp2 dependencies
RUN apk add --update openssl nghttp2
# nghttp2 dependencies
RUN apk add --update nghttp2
# Expose https port for restconf # Expose https port for restconf
EXPOSE 80/tcp EXPOSE 80/tcp
EXPOSE 443/tcp EXPOSE 443/tcp
# Add sshd
RUN apk add --update openrc openssh
RUN rc-update add sshd
RUN rc-status
RUN echo "Subsystem netconf /usr/local/bin/clixon_netconf" >> /etc/ssh/sshd_config
# Create clicon user and group # Create clicon user and group
RUN adduser -D -H clicon RUN adduser -D -H clicon

View file

@ -62,6 +62,9 @@ distclean: clean
docker: clixon Dockerfile docker: clixon Dockerfile
sudo docker build -t $(IMG) $(DOCKERFLAGS) . sudo docker build -t $(IMG) $(DOCKERFLAGS) .
start: docker
./start.sh # kill (ignore error) and the start it
push: push:
sudo docker push $(IMG) sudo docker push $(IMG)
depend: depend:

View file

@ -6,7 +6,11 @@ This clixon example container uses native http.
## Build ## Build
Perform the build by `make docker`. This copies the latest _committed_ clixon code into the container. Perform the build by:
```
$ make docker
```
This copies the latest _committed_ clixon code into the container.
## Start ## Start
@ -15,10 +19,15 @@ Start the container:
$ ./start.sh $ ./start.sh
``` ```
If you want to install your pre-existing pub rsa key in the container: If you want to install your pre-existing pub rsa key in the container, and change the name:
``` ```
$ SSHKEY=true ./start.sh $ SSHKEY=true NAME=clixon-example22 ./start.sh
```
You can combine make and start by:
```
$ make start
``` ```
## Run ## Run

View file

@ -35,7 +35,10 @@
# Debug: DBG=1 ./startup.sh # Debug: DBG=1 ./startup.sh
# See also cleanup.sh # See also cleanup.sh
# If tru also install your users pubkey # Name of container
: ${NAME:=clixon-example}
# If true also install your users pubkey
: ${SSHKEY:=false} : ${SSHKEY:=false}
>&2 echo "Running script: $0" >&2 echo "Running script: $0"
@ -43,7 +46,7 @@
sudo docker kill clixon-example 2> /dev/null # ignore errors sudo docker kill clixon-example 2> /dev/null # ignore errors
# Start clixon-example backend # Start clixon-example backend
sudo docker run --name clixon-example --rm -td clixon/clixon-example #|| err "Error starting clixon-example" sudo docker run --name ${NAME} --rm -td clixon/clixon-example #|| err "Error starting clixon-example"
# Copy rsa pubkey # Copy rsa pubkey
if $SSHKEY; then if $SSHKEY; then