Advanced container settings

When creating or editing a container you can configure a number of additional settings in the Advanced container settings section.

Command & logging

In this section you can configure the command that runs when the container starts as well as configure logging for the container.

Volumes

Here you can configure volume mappings for your container. You can map to existing named volumes or bind mount to locations on your Docker host.

Network

In this section you can configure the network settings for the container.

Note that you cannot assign a static IP address to a container that is in Docker's default bridge network. This is a Docker limitation rather than Portainer. If you need to specify the IP for your container then you will need to create a custom network and assign the container to it.

Env

Use this section to add or edit environment variables made available in the container. Click Add an environment variable to create a new variable, or edit an existing variable with the fields provided. You can also click Load variables from .env file to import an existing .env file with your variables. To remove a variable, click the trash can icon to the right of the variable to remove.

If you want to add multiple variables at once, click on Advanced mode to switch to an editor view where you can paste a block of variables and values.

Labels

You can set labels on your container using this section. Click add label to add a new label, or edit an existing label using the fields provided. To remove a label, click the trash can icon to the right of the label to remove.

Restart policy

Use this section to configure the restart policy for your container. Possible options are:

  • Never: Do not automatically restart the container when it exits. This is the default.

  • Always: Always restart the container regardless of the exit status. When you specify always, Docker will try to restart the container indefinitely. The container will also always start on Docker startup, regardless of the current state of the container.

  • On failure: Restart only if the container exits with a non-zero exit status.

  • Unless stopped: Always restart the container regardless of the exit status, including on Docker startup, except if the container was put into a stopped state before Docker was stopped.

Runtime & Resources

This section lets you configure runtime options for your container, add or configure GPUs for use within the container, and specify resource limitations on the container.

Runtime

Here you can configure runtime options for the container.

GPU

Here you can enable GPU access for the container and configure the GPU settings as required.

GPU support is currently only available on Docker Standalone environments, and only supports NVIDIA GPUs.

Resources

Here you can configure resource limits for your container. You can use the sliders to set the value or enter a value in the fields.

Capabilities

In this section you can configure the individual capabilities for your container. For more information refer to the Docker documentation.