Create a Docker Version

Issue #875 resolved
Josef Fröhle created an issue

Hi,

i looking to create a Docker version of mailpiler, but cause of the "install" it is not as easy as i thought.

Can you support me or create a docker version?

I would prefer to setup a docker-compose setup, with webgui, piler, clam and mysql.

Comments (20)

  1. Janos SUTO repo owner

    Hello, a docker image is quite possible, I use it even for myself running tests, etc. However, I don't use docker-compose, since everything is in a single container.

    This setup may not be good enough for production use, so I think it's better to use a remote mysql server, and let the user decide whether the mysql server is on another container or in a virtual machine, whatever. How about that?

  2. Josef Fröhle reporter

    Hello Janos, that sounds greate. Would you like to push your Dockerfile? Or how you do the build process? So I would be able to create a docker-compose.yaml for it and/or all other docker services.

    Thank you. Regards, Josef

  3. Former user Account Deleted

    Hello,

    i think this is a great idea. I'm using piler on a separate machine (not dockerized) in connection to a dockerized version of a mailserver. So i'm very interested in this developement.

  4. Janos SUTO repo owner

    OK, I've just pushed sutoj/piler:latest to docker hub. Consider it as a prototype at the moment, good for trying.

    Prerequisites: a working mysql server with the following sql commands:

    grant all privileges on piler.* to 'piler' identified by 'piler123';
    flush privileges;
    

    Feel free to fix the password in the query above.

    Then get the docker image, and run it as follows:

    docker run --name piler -d -e PILER_HOSTNAME=archive.yourdomain.com -e MYSQL_HOSTNAME=mysql -e MYSQL_DATABASE=piler -e MYSQL_USERNAME=piler -e MYSQL_PASSWORD=piler123 -p 25:25 -p 80:80 sutoj/piler
    

    Use the same password what you specified just before.

    A few things might be improved however: - use https instead of http - use your own piler.key, not the one generated by the deb package Note that you may override it using -v /path/to/piler.key:/etc/piler/piler.key:ro option - specify a volume for /var/piler/store/00 and /var/piler/sphinx directories to provide a persistent storage for the container

    So, be sure to try it, and let me know how it works for you.

  5. Former user Account Deleted

    Hi Janos,

    i really appreciate your great work and efforts. A long time has passed by since my last post, but work and other projects took much more time as i expected. Now i have some to "spent" and would like to try out a version of dockerized piler. Would you mind sharing you Dockerfile?

    Regards Feuernatter

  6. Janos SUTO repo owner

    Hello Feuernatter, ok, I'll give it to you. I use two steps to create the docker image. I have a 'stage1' image with all the run time dependencies, ie. libs (libssl, libtre, ...) and applications (eg. mysql, nginx, pdftotext, ...) installed. Then I use this image as a base and deploy the piler deb package to create stage2.

    I suggest you to get sutoj/piler:xenial.stage1 from docker hub, and experiment with it. All it needs is to install a deb package, and perhaps customize its config. You may try this one: http://download.mailpiler.org/piler_1.4.1~xenial-6c9b258_amd64.deb

    I strongly recommend to use it for testing, since it uses the internal storage for all data (mysql, sphinx, mail files, ...).

    With that being said, it suits my tests, perhaps later I'll compile a docker image using external mysql server, and using a mounted (or mapped) filesystem to store emails suitable for production. I'll figure out how to ship and distribute it.

  7. Former user Account Deleted

    Hi Janos,

    thank you for sharing yout code. I noticed that you use ubuntu as a base image. Does this fit on a debian machine too?

  8. Ralph t (ralphte)

    Hi Janos,

    Could you please post the current docker files for this build. The pastebin post is not live anymore. Also would it be possible to included this docker file in the source.

    Thanks

  9. Karlo Koloda

    Hi,

    Thank you all the hard work you put into mailpiler but I have an issue when running the Dockerfile. It says:

    “Error response from daemon: Dockerfile parse error line 8: unknown instruction: PACKAGE="${PACKAGE}"“

    Thanks

    Edit: Never mind there was a \ missing in the line before package=”$(PACKAGE)”

  10. Karlo Koloda

    Hi,

    thank you for the response the Dockerfile was the issue a \ was missing in the line before package. Now it runs.

    EDIT: Also needed to add RUN chmod +x start.sh in Dockerfile and rebuild.

  11. Rob Wagnon

    What to do about:

    Step 6/10 : ADD start.sh /start.sh
    ADD failed: stat /var/lib/docker/tmp/docker-builder374381144/start.sh: no such file or directory

    For those less familiar with Docker, you need a folder with both Dockerfile and start.sh from this bitbucket:

    https://bitbucket.org/jsuto/piler/src/master/docker/

    Then from that folder, run

    docker build --build-arg PACKAGE=piler_1.3.7-bionic-94c54a0_amd64.deb .

    The dot represents the current folder.

  12. Teh No

    hi Janos,

    I know this is an old thread but didn’t want to create an issue as this is not an issue per se, I was wondering if you’d be ok with uploading the Dockerfile for the piler-1.3.12 image on Dockerhub ?

  13. Log in to comment