diff --git a/docker/example/Dockerfile b/docker/example/Dockerfile index b94850c5..bc0a1e37 100644 --- a/docker/example/Dockerfile +++ b/docker/example/Dockerfile @@ -93,15 +93,19 @@ RUN apk add --update flex bison # need to add www user manually RUN adduser -D -H -G www-data www-data -RUN apk add --update openssl - -# nghttp2 dependencies -RUN apk add --update nghttp2 +# openssl and nghttp2 dependencies +RUN apk add --update openssl nghttp2 # Expose https port for restconf EXPOSE 80/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 RUN adduser -D -H clicon diff --git a/docker/example/Makefile.in b/docker/example/Makefile.in index fa3b27dc..ffbbbca8 100644 --- a/docker/example/Makefile.in +++ b/docker/example/Makefile.in @@ -62,6 +62,9 @@ distclean: clean docker: clixon Dockerfile sudo docker build -t $(IMG) $(DOCKERFLAGS) . +start: docker + ./start.sh # kill (ignore error) and the start it + push: sudo docker push $(IMG) depend: diff --git a/docker/example/README.md b/docker/example/README.md index 58cc9561..90fb3723 100644 --- a/docker/example/README.md +++ b/docker/example/README.md @@ -6,7 +6,11 @@ This clixon example container uses native http. ## 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 @@ -15,10 +19,15 @@ Start the container: $ ./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 diff --git a/docker/example/start.sh b/docker/example/start.sh index 596b9a86..e6b07280 100755 --- a/docker/example/start.sh +++ b/docker/example/start.sh @@ -35,7 +35,10 @@ # Debug: DBG=1 ./startup.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} >&2 echo "Running script: $0" @@ -43,7 +46,7 @@ sudo docker kill clixon-example 2> /dev/null # ignore errors # 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 if $SSHKEY; then