Permalink
Fetching contributors…
Cannot retrieve contributors at this time
135 lines (92 sloc) 3.22 KB
title description headerTitle layout weight
Deploying Docker
Launch a Docker application in few seconds.
Deploy
guide
8

Docker

{$page.description}

Introduction

Docker is the world’s leading software container platform. Developers use Docker to eliminate β€œworks on my machine” problems when collaborating on code with co-workers. Enterprises use Docker to build agile software and ship new features faster.

Try it yourself

Want to see the process of deploying Docker step by step?

Configuring

All WeDeploy projects use similar configuration files to prepare your projects for deployment. Learn more on our page about Getting Started with Deploying.

Below is an example of a wedeploy.json for a Docker container. The id for your services are uniquely determined by you.

{
  "id": "myservice"
}

You need to place a wedeploy.json wherever you have a Dockerfile. If you were deploying a Wordpress site using Docker images for Wordpress and a MySQL database, this is what your project could look like:

myservice
β”œβ”€β”€ db
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── wedeploy.json
└── wp
    β”œβ”€β”€ Dockerfile
    └── wedeploy.json

Ports

Automatic Detection

When deploying a docker image, WeDeploy will look inside the Dockerfile to see what ports are exposed. If there is only one, then we will use that one, but if there are multiple ports exposed, we will use the lowest value port.

For example, if you had a Dockerfile like this:

FROM ubuntu
EXPOSE 3000
EXPOSE 4000

We would automatically expose port 3000 for your service so that it can be accessed publicly via your service URL (service-project.wedeploy.io).

Manual Configuration

What if you what to choose a specific port to expose on your service? You can do this by setting a value on the port value in your wedeploy.json.

{
  "id": "myubuntu",
  "port": 4000
}

You can also block all external access to your container by setting a port in your wedeploy.json that is not exposed in your Dockerfile.

{
  "id": "myubuntu",
  "port": 0
}

Docker Hub

Calling a public image from Docker Hub can be done with a single line of code in your wedeploy.json file. Use the image parameter to tell WeDeploy what Docker Hub image to pull. Your wedeploy.json could look like this to deploy a MySQL database:

{
  "id": "mydb",
  "image": "mysql",
  "volumes": {
    "mysql": "/var/lib/mysql"
  },
  "env": {
    "MYSQL_ROOT_PASSWORD": "pass"
  }
}

What's next?

Now you can start building your docker based application.