Creating Varnish service from not an official Docker Image

Let's review the case when an app has not an official Docker Image, and you want to create your own from scratch. For example famous cache-proxy service Varnish.

1. Go into your D2C account at https://panel.d2c.io, click "Create project" on dashboard

2. Click "Create service"

3. Choose "Docker"

Denis Zaripov

Product owner

3. Specify Docker Image as "debian", version "jessie" and fill in Install commands:

apt-get install wget
wget -qO- https://packagecloud.io/install/repositories/varnishcache/varnish51/script.deb.sh | bash
apt-get install varnish

5. Enable access from the Internet and set main port to 80

6. Fill in Start Command.
Here starts Varnish from user vcache with allocation 100MB RAM, specifying the path to the config file and listening interface.

varnishd -j unix,user=vcache -F -f /etc/varnish/default.vcl -s malloc,100m -a 0.0.0.0:80

7. Create custom config and set the path to it: "/etc/varnish/default.vcl"

varnishd -j unix,user=vcache -F -f /etc/varnish/default.vcl -s malloc,100m -a 0.0.0.0:80

8. Fill it in with the following:

vcl 4.0;
backend default {
.host = "web";
.port = "80";
}

"web" - container alias of application which Varnish will proxy

9. Choose a host and click "Create service"

That's all! Varnish service will be deployed on your host.
You will see it on a project page.