Docker FTP Server Container Create Accessible Sub-directories
I am trying to create a Docker image to act as an FTP server. I am using the stilliard/pure-ftpd:hardened image (https://github.com/stilliard/docker-pure-ftpd).
I want to allow access to a user called ‘elections’ and to create two directories which will be accessible to that user, called ‘nominations’ and ‘results’. I extended the base image as follows:
FROM stilliard/pure-ftpd:hardened RUN (echo elections; echo elections) | pure-pw useradd elections -u ftpuser -d /home/ftpusers/elections RUN pure-pw mkdb RUN chown -hR ftpuser:ftpgroup /home/ftpusers RUN mkdir -r /home/ftpusers/elections/nominations /home/ftpusers/elections/results
(I know that echoing the password is bad, but it’s only on my dev machine for now!). I assumed that the two directories ‘nominations’ and ‘results’ would now be created and accessible to the user. But, when I run the Docker container these directories are not present.
If I connect to the running container using elections@container-ip then I am able to create directories, but I want them to be present when I build the image.
Can anyone explain what it is that I am misunderstanding here?