Back to Portainer

Add a new volume

user/docker/volumes/add.md

1.23.28.3 KB
Original Source

Add a new volume

Adding a local volume

From the menu select Volumes then click Add volume.

<figure><figcaption></figcaption></figure>

Complete the information in the Create volume screen, using the table below as a guide.

Field/OptionOverview
NameGive the volume a descriptive name.
DriverSelect local.
Use NFS volumeToggle this off.
Use CIFS volumeToggle this off.
DeploymentOn a multi-node cluster, define the node that will hold the volume.
<figure><figcaption></figcaption></figure>

When you're finished, click Create the volume.

Adding an NFS volume

{% hint style="info" %} In Portainer, you can mount an NFS volume to persist the data of your containers. {% endhint %}

From the menu select Volumes then click Add volume.

<figure><figcaption></figcaption></figure>

Complete the information in the Create volume screen, using the table below as a guide.

Field/OptionOverview
NameGive the volume a descriptive name.
DriverSelect local.
Use NFS volumeToggle this on.
Use CIFS volumeToggle this off.
DeploymentOn a multi-node cluster, define the node that will hold the volume.
<figure><figcaption></figcaption></figure>

Under the NFS Settings section, complete the following.

Field/OptionOverview
AddressEnter the hostname or IP address of your NFS server.
NFS VersionSelect the NFS version that your NFS server uses.
Mount pointEnter the path where the volume is mounted, for example /mnt/nfs01.
OptionsLeave the default values.
<figure><figcaption></figcaption></figure>

When you're finished, click Create the volume.

Adding a CIFS volume

{% hint style="info" %} In Portainer, you can mount a CIFS volume to persist the data of your containers. {% endhint %}

From the menu select Volumes then click Add volume.

<figure><figcaption></figcaption></figure>

Complete the information in the Create volume screen, using the table below as a guide.

Field/OptionOverview
NameGive the volume a descriptive name.
DriverSelect local.
Use NFS volumeToggle this off.
Use CIFS volumeToggle this on.
DeploymentOn a multi-node cluster, define the node that will hold the volume.
<figure><figcaption></figcaption></figure>

Under the CIFS Settings section, complete the following:

Field/OptionOverview
AddressEnter the CIFS server name or IP address.
ShareEnter the name of the share resource.
CIFS VersionSelect the CIFS version that you are using.
UsernameEnter the user to authenticate.
PasswordEnter the password to authenticate.
<figure><figcaption></figcaption></figure>

When you're finished, click Create the volume.

Adding a tmpfs volume

From the menu select Volumes then click Add volume.

<figure><figcaption></figcaption></figure>

Complete the information in the Create volume screen, using the table below as a guide.

Field/OptionOverview
NameGive the volume a descriptive name.
DriverSelect local.
Driver optionsClick add driver option then add the following name/value combinations:
<ul><li><p>name: <code>type</code></p><p>value: <code>tmpfs</code></p></li><li><p>name: <code>device</code></p><p>value: <code>tmpfs</code></p></li><li>name: <code>o</code></li><li>value: <code>size=100m,uid=1000</code> (customize these values to suit your needs)</li></ul>
Use NFS volumeToggle this off.
Use CIFS volumeToggle this off.
DeploymentOn a multi-node cluster, define the node that will hold the volume.
<figure><figcaption></figcaption></figure>

When you're finished, click Create the volume. The volume can now be attached to a container in the same way as any other volume.

<figure><figcaption></figcaption></figure>

Once attached, you can confirm that the tmpfs volume has been mounted correctly within the container:

<figure><figcaption></figcaption></figure>