Docker Options

Customize docker options and image configurations.

Customize docker image

During Prepare Bundle, orup builds a new docker image that includes your app's code. You can customize this image by adding additional build instructions that are run before adding your app. This can be used to install dependencies your app needs, such as adding imagemagick or node-canvas’s dependencies.

You can add instructions with app.docker.buildInstructions. An example is:

module.exports = {
  app: {
    name: 'app',
    path: '../',
    servers: { one: {} },
    docker: {
      buildInstructions: [
        'RUN apt-get update && apt-get install -y imagemagick'
      ]
    }
  }
};

Each item is added on a new line in the Dockerfile, and should start with RUN, USER, or another dockerfile instruction. If the base docker image runs the app as a non-root user, you might need to switch the user to root for your RUN commands, and back to the non-root user afterwards.

After changing the config, run orup deploy.

Listening to specific IP address (IP Binding)

If you want Docker to listen only on a specific network interface, such as 127.0.0.1, add a variable called bind with the value of the IP address you want to listen to.

app: {
 ...
 docker: {
  ...
  bind: '127.0.0.1'
  ...
 }
}

Docker networks

If you need to connect your docker container to one or more networks add a variable called networks inside the docker configuration. This is an array containing all network names to which it has to connect.

app: {
 ...
  docker: {
    ...
    networks: [
      'myNetwork1'
    ]
    ...
  }
 ...
}

Custom Docker Registry

Simply reference the docker image by url in the app.docker.image setting:

app: {
 ...
  docker: {
    ...
    image: 'registry.gitlab.com/someregistry/someimage:sometag'
  }
}

And then add a docker setup hook to login to your private registry on the server. See Hooks for example of logging into a private docker registry.

Image Port

You can set app.docker.imagePort to the port to expose from the container. This does not affect the port the app accessed on, only the port the app runs on inside the docker container.