Scalingo Docker Image Addon
Introduction
Each time you push code to Scalingo, a build is triggered resulting in the construction of a Docker Image. When this build phase is successful we try to deploy this Docker Image by trying to run it on the platform. This addon lets you download every Docker Image that has been built by Scalingo.
Use Cases
Because the Docker image is the exact same one we are running in the platform, you can use it to debug your production code or as a pledge of reversibility.
You can also use Scalingo as a Docker Integration Platform. You push your code from one side and get a generic Docker Image on the other. You can then use Scalingo for your staging environments and run the final Docker image on your own private cloud or the one from your customers. It’s especially useful when your customers ask to run your application in their own environments for various reasons (Big Co wanting to control their infrastructure, legal reasons like in the MedTech world for instance).
Setup of the Addon
Provision the addon for your application from our web dashboard or with our CLI:
scalingo addons-add scalingo-docker-image base-plan
Usage of the Addon
Once the addon has been provisioned, the deployments part of your app on the dashboard will change, a Docker logo will appear. Click on it to get the instructions to download the image of a given deployment.
Application Registry URL
The application registry URL depends on the region your application is running on.
It is designated by DOCKER_REGISTRY_URL
in this documentation and must be replaced with one of the following values:
- osc-fr1:
registry-3-osc-fr1.scalingo.com
- osc-secnum-fr1:
registry-3-osc-secnum-fr1.scalingo.com
Login to Your Application Registry
$ docker login $DOCKER_REGISTRY_URL
Username: <Scalingo username>
Password: <Scalingo API token>
The API token must be created on your profile, copy it from there.
Download Your Image
$ docker pull $DOCKER_REGISTRY_URL/app-my-app:0123456789abcdef
0123456789abcdef: Pulling from app-my-app
6599cadaf950: Downloading 59.99 MB/65.69 MB
23eda618d451: Download complete
f0be3084efe9: Download complete
52de432f084b: Download complete
a3ed95caeb02: Download complete
b11499e07372: Download complete
40d9c9cec188: Download complete
b7c87d00e3ba: Downloading 31.84 MB/362.9 MB
9aac245cd453: Downloading 23.74 MB/60.04 MB
f1ac1758a0cb: Waiting
Run Your App
The entrypoint of the image is a script located at /start
. Its usage is:
/start <container type>
# Example: Start the web (default) process
/start web
The complete docker command to start your app on port 4000 looks like the following:
docker run -it \
-e PORT=4000 \
--publish 4000:4000 \
--user appsdeck \
$DOCKER_REGISTRY_URL/app-my-app:0123456789abcdef /start web
In this case no environment variable has been set, you need to add the
environment variables required by your app by adding multiple -e
flags:
docker run -it \
-e PORT=4000 \
-e RAILS_ENV=production \
-e RACK_ENV=production \
-e DATABASE_URL=postgres://172.17.0.1:5432 \
-e MAIL_URL=smtp://user:password@mailprovider.com:587 \
--publish 4000:4000 \
--user appsdeck \
$DOCKER_REGISTRY_URL/app-my-app:0123456789abcdef /start web
That’s it, your app is running with your environment.