Dino Geek, try to help you

How to share a volume between multiple Docker containers?


To share a volume between multiple Docker containers there are two steps to follow:

1. Create a volume.

You can create a volume using the `docker volume create` command.

```
docker volume create myvol
```

1. Use the volume in your containers.

You can use the -v or —volume option in your `docker run` commands to mount a volume to your containers.

As an example to share a volume between two Ubuntu containers, your commands would look like this:

```

  1. create and start the first container
    docker run -d —name mycontainer1 -v myvol:/data ubuntu

  1. start the second container with the same volume
    docker run -d —name mycontainer2 -v myvol:/data ubuntu
    ```

This will create two different Ubuntu containers (`mycontainer1` and `mycontainer2`) that share the same volume (`myvol`), mounted at the `/data` directory.

It is important to note that changes made in the directory `/data` inside one container are also visible in the directory `/data` inside the other container, since they share the same volume.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use