mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
docs: clarify bind mounts for Podman also (#2157)
This commit is contained in:
parent
adeee3135f
commit
ebf59f0a83
@ -8,7 +8,7 @@ Everything the container manages is located under the **container's** `/data` pa
|
||||
|
||||
### Attaching data directory to host filesystem
|
||||
|
||||
In most cases the easiest way to persist and work with the minecraft data files is to use the [volume mounting](https://docs.docker.com/storage/volumes/) `-v` argument to map a directory on your host machine to the container's `/data` directory. In the following example, the path `/home/user/minecraft-data` **must be** a directory on your host machine:
|
||||
In most cases the easiest way to persist and work with the minecraft data files is to use [bind mounts](https://docs.docker.com/storage/bind-mounts/) with the `-v` argument to map a directory on your host machine to the container's `/data` directory. In the following example, the path `/home/user/minecraft-data` **must be** a directory on your host machine:
|
||||
|
||||
-v /home/user/minecraft-data:/data
|
||||
------------------------- -----
|
||||
@ -19,6 +19,15 @@ In most cases the easiest way to persist and work with the minecraft data files
|
||||
|
||||
When attached in this way you can stop the server, edit the configuration under your attached directory and start the server again to pick up the new configuration.
|
||||
|
||||
!!! important "Rootless, Podman, SELinux, AppArmor usage"
|
||||
When running rootless containers, such as with Podman, or using SELinux / AppArmor on your system, append ":Z" to the volume mapping. For example:
|
||||
|
||||
```
|
||||
/home/user/minecraft-data:/data:Z
|
||||
```
|
||||
|
||||
There might be a safer/better way to accommodate these systems. Please post an issue or PR if you have more information.
|
||||
|
||||
With Docker Compose, setting up a host attached directory is even easier since relative paths can be configured. For example, with the following `docker-compose.yml` Docker will automatically create/attach the relative directory `minecraft-data` to the container.
|
||||
|
||||
``` yaml title="docker-compose.yml"
|
||||
@ -39,10 +48,6 @@ services:
|
||||
- ./minecraft-data:/data
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
if you have SELinux enabled, then you might need to add `:Z` to the end of volume mount specifications, [as described here](https://prefetch.net/blog/2017/09/30/using-docker-volumes-on-selinux-enabled-servers/).
|
||||
|
||||
### Converting anonymous `/data` volume to named volume
|
||||
|
||||
If you had used the commands in the first section, without the `-v` volume attachment, then an anonymous data volume was created by Docker. You can later bring over that content to a named or host attached volume using the following procedure.
|
||||
|
Loading…
Reference in New Issue
Block a user