Custom UID and made container restartable

This commit is contained in:
Ambroise Maupate 2015-06-02 20:55:37 +02:00
parent 5767071943
commit fd81a785db
2 changed files with 6 additions and 6 deletions

View file

@ -3,6 +3,7 @@ MAINTAINER Knut Ahlers <knut@ahlers.me>
ENV USER share
ENV PASS changeme
ENV USER_UID 1000
RUN apt-get update && \
apt-get install -y openssh-server mcrypt && \

View file

@ -1,12 +1,11 @@
#!/bin/bash
ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' ${PASS})
if ( id ${USER} ); then
echo "FATAL: User ${USER} already exists"
exit 1
echo "INFO: User ${USER} already exists"
else
echo "INFO: User ${USER} does not exists, we create it"
ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' ${PASS})
useradd -d /data -m -p ${ENC_PASS} -u ${USER_UID} -s /bin/sh ${USER}
fi
useradd -d /data -m -p ${ENC_PASS} -u 1000 -s /bin/sh ${USER}
exec /usr/sbin/sshd -D