(Dec 29) New version 0.9.8-18 has been released

Docker container as web backend. Topic is solved

Questions regarding the API
Application Programming Interface
Forum rules
Before creating a new topic or reply on the forum you should fill out additional fields "Os" and "Web" in your profile section.
In case of violation, the topic can be closed or response from the support will not be received.
Posts: 2
Joined: Sat Aug 08, 2015 7:11 am

Docker container as web backend.

Postby ij3net » Thu Oct 27, 2016 8:54 pm

I'm create proxy template that build and run docker container and setup it as web backend for nginx. So i'm interesting if someone trying some similar?

In my case i use it for build and configure some specific php environment. Default user doc_root attached to container as a volume. And host installed mysql server connected to container via socket volume.


Code: Select all

# Changing public_html permission
userid=`id -u $user`
#chmod 755 $docroot
mkdir -p $home_dir/docker/log
cp -R -a /usr/local/vesta/data/templates/web/skel/docker/* $home_dir/docker
echo "/usr/local/vesta/data/templates/web/nginx/docker/default.sh was running with user $user and $home_dir and doc_root $docroot" > $home_dir/docker.flag
sed -i "s/11080/$port/" $home_dir/conf/web/nginx.conf
echo "version: '2'
    build: ./apache
      - $port:80
      - $docroot:/var/www/html
      - ./apache/date-timezone.conf:/etc/apache2/conf-enabled/date-timezone.conf
      - ./apache/encoding.conf:/etc/apache2/conf-enabled/encoding.conf
      - ./apache/php.ini:/usr/local/etc/php/php.ini
      - ./log:/var/log/apache2
      - /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock
        soft: -1
        hard: -1
        soft: 65536
        hard: 65536
        stack: -1
      - 'TZ=Asia/Vladivostok'
" > $home_dir/docker/docker-compose.yml
cd $home_dir/docker/
docker-compose -p $user down > $home_dir/docker/log/docker-compose_down.log
docker-compose -p $user up -d > $home_dir/docker/log/docker-compose_up.log
exit 0


Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    root        %docroot%;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    location / {

        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;

        proxy_pass  http://localhost:11080;


    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;
    include     %home%/%user%/conf/web/nginx.%domain%.conf*;

Posts: 1
Joined: Fri Nov 18, 2016 1:18 pm

Re: Docker container as web backend.

Postby pottsonian » Wed Nov 30, 2016 5:33 pm

Hi, did you take this into a production server? How is it going? Have you got any updated configs / code?
I am currently looking to do exactly the same. Have not started yet, still reading docker guides and getting my head around the best way to handle the persistent data volumes. Was thinking of rsyncing the vesta domain web folder with each docker volume web folder.

Also considering extending the add domain command to generate a docker, and set the configs and data volumes. So in principle you can setup a dockerised domain from the vesta front end. Could then add a few triggers to the vesta frontend to manage the container: reboot, reimage.

Happy wednesday

Posts: 41
Joined: Thu Jan 05, 2017 9:20 pm

Re: Docker container as web backend.  Topic is solved

Postby noogen » Tue Feb 14, 2017 4:35 am

Unlike the op, I implemented full docker for vestacp here: https://hub.docker.com/r/niiknow/vestacp/

Since it's a monolithic image, it does defeat the purpose of docker/microservice design. Of course, it was for a different purpose. I just want to host with VESTA but didn't want to blow away or mess up my external VPS setup. I currently run several of these in Production.

Posts: 9
Joined: Fri Jan 05, 2018 3:03 pm

Os: Debian 9x
Web: nginx + php-fpm

Re: Docker container as web backend.

Postby jodumont » Sat Jan 06, 2018 8:35 am

Hi ij3net, pottsonian, noogen, and others with the same interest of us;

Yes I'm new on this forum but, use VestaCP since over a year, contribute a little bit, love bash and docker...
I also works with docker through Libre.sh, Cloudron and my own project.

I already have basic scripts to install Docker and docker-compose on systemd system like Debian8-9, CentOS7 and Ubuntu 16LTS.

So my point is to see if someone want to work with me on integrating Docker in VestaCP for production ?
Nothing crazy at the beginning we could choose to work with only one OS and using portainer to have a WebUI (it's an example).

So Let's me know if you have an interest.



PS: I also speak french if the person is more comfortable in this language.

Return to “Scripting / API”

Who is online

Users browsing this forum: No registered users and 1 guest