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:

  • How to write and persist data in a VOLUME of an image FROM which my Dockerfile is based?
  • Container with app + DB
  • Insert Docker parent host ip into container's hosts file
  • Mount (link) a single file from a docker container volume
  • Docker Compose: Rails won't respect the DATABASE_URL to connect to Postgres
  • Failing to see how ambassador pattern enhances modularity / simplicty of container architecture in Docker
  • 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?

  • Use Docker with my Ubuntu 14.04 (web access)
  • Running PHPUnit within a Docker container with PhpStorm
  • Sidekiq using the incorrect url for redis
  • Access to Docker container
  • Eureka cluster and docker-compose: Registering with host even when I set preferIpAdress: true
  • `const_get': uninitialized constant [class] (NameError)` after file save in Docker with Spring
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.