How can I make actual image files persistent in file upload process running with docker?

Recently I have developed an application running with docker in PHP including file upload process.

However, actual uploaded files to the server would have been lost when the container exits.

  • Passing docker container IP address to container
  • Mount remote docker instance to my OSX file system
  • How to restart tcserver instance within docker?
  • Docker Container CPU Usage
  • Can I clean /var/lib/docker/tmp?
  • Does Spark Job Server have to be deployed on the same host as Spark Master?
  • How did you deal with the matter?
    Please tell me how to make files persistent.

    For example:

    • Using external server like S3 for storing files.
    • Utilizing Docker storage functions for volumes.

  • How to prevent docker containers from consuming all CPU?
  • register docker container to host network dns
  • NLTK is not working in docker
  • Parallel test processes within docker container
  • Setting up private docker registry with a frontend
  • how to map database from couchdb container to another containers webapp in same docker-compose file
  • One Solution collect form web for “How can I make actual image files persistent in file upload process running with docker?”

    This can be done using docker compose. You will be able to access the files inside container by mounting them to external host directory. The files uploaded to wordpress are stored in wp-content/uploads and you can mount this using this sample docker-compose file:

    version: '3'
        image: mysql
        container_name: mysql-database
          - ./mysql/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d
          - 3306:3306
        image: wordpress:custom
          context: ./wordpress
          dockerfile: wordpress.dockerfile
        container_name: wordpress-sites
          - mysql-database
          - mysql-database
          - 8080:80
          - ./wordpress/wp-content:/var/www/html/wp-content

    The documentation regarding volumes should be able to help you.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.