Skip to content

Commit 5fefa8f

Browse files
feat: Document volume permissions for InfluxDB Docker (#6541)
* feat: Document volume permissions for InfluxDB Docker Added instructions for setting volume permissions for InfluxDB Docker container. * feat: Update information about macos * feat: cleanup * chore(v1): Distinguish and format Docker examples for Linux/Windows vs MacOS --------- Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>
1 parent 1075415 commit 5fefa8f

File tree

1 file changed

+57
-5
lines changed
  • content/influxdb/v1/introduction/install

1 file changed

+57
-5
lines changed

content/influxdb/v1/introduction/install/docker.md

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ This guide covers Docker installation, configuration, and initialization options
3535
- [Access the InfluxDB CLI](#access-the-influxdb-cli)
3636
- [Next steps](#next-steps)
3737

38-
3938
## Install and run InfluxDB
4039

4140
### Pull the InfluxDB v1.x image
@@ -44,8 +43,34 @@ This guide covers Docker installation, configuration, and initialization options
4443
docker pull influxdb:{{< latest-patch >}}
4544
```
4645

46+
### Volume permissions
47+
48+
> \[!Important]
49+
> The InfluxDB Docker container runs as user influxdb with UID/GID 1500.
50+
> When mounting volumes for persistent storage, ensure the mounted directory on the host is owned by UID/GID 1500, or InfluxDB may not have permission to write data.
51+
52+
Set the correct ownership before starting the container:
53+
54+
#### Create the data directory
55+
56+
mkdir -p data
57+
58+
#### Set ownership to UID/GID 1500
59+
60+
sudo chown -R 1500:1500 data
61+
4762
### Start InfluxDB
4863

64+
> \[!Important]
65+
> On MacOS due to issues related to docker desktop's VM and local binds
66+
> you must use either a *delegated local directory* or a *named volume* when starting a container.
67+
68+
{{< tabs-wrapper >}}
69+
{{% tabs %}}
70+
[Linux/Windows](#)
71+
[MacOS (Docker Desktop)](#)
72+
{{% /tabs %}}
73+
{{% tab-content %}}
4974
Start a basic InfluxDB container with persistent storage:
5075

5176
```bash
@@ -54,7 +79,31 @@ docker run -p 8086:8086 \
5479
influxdb:{{< latest-patch >}}
5580
```
5681

57-
InfluxDB is now running and available at http://localhost:8086.
82+
{{% /tab-content %}}
83+
{{% tab-content %}}
84+
On MacOS, you must use either a *delegated local directory* or a *named volume* when starting an InfluxDB container.
85+
86+
**Option A: Use a delegated local directory**
87+
88+
```bash
89+
docker run -p 8086:8086 \
90+
-v $PWD/data-test2:/var/lib/influxdb:delegated \
91+
influxdb:{{< latest-patch >}}
92+
```
93+
94+
**Option B: Use a named docker volume (still local, but managed by Docker Desktop)**
95+
96+
```bash
97+
docker run -d --name influxdb \
98+
-p 8086:8086 \
99+
-v influxdb-data:/var/lib/influxdb \
100+
influxdb:{{< latest-patch >}}
101+
```
102+
103+
{{% /tab-content %}}
104+
{{< /tabs-wrapper >}}
105+
106+
InfluxDB is now running and available at <http://localhost:8086>.
58107

59108
## Configure InfluxDB
60109

@@ -92,7 +141,7 @@ docker run -p 8086:8086 \
92141

93142
### Automatic initialization (for development)
94143

95-
> [!Warning]
144+
> \[!Warning]
96145
> Automatic initialization with InfluxDB v1 is not recommended for production.
97146
> Use this approach only for development and testing.
98147
@@ -109,6 +158,7 @@ docker run -p 8086:8086 \
109158
```
110159

111160
Environment variables for user creation:
161+
112162
- `INFLUXDB_USER`: Create a user with no privileges
113163
- `INFLUXDB_USER_PASSWORD`: Password for the user
114164
- `INFLUXDB_READ_USER`: Create a user who can read from `INFLUXDB_DB`
@@ -146,10 +196,11 @@ docker run -p 8086:8086 \
146196
```
147197

148198
Supported script types:
199+
149200
- Shell scripts (`.sh`)
150201
- InfluxDB query language files (`.iql`)
151202

152-
> [!Important]
203+
> \[!Important]
153204
> Initialization scripts only run on first startup when the data directory is empty.
154205
> Scripts execute in alphabetical order based on filename.
155206
@@ -166,6 +217,7 @@ Replace `<container-name>` with your InfluxDB container name or ID.
166217
## Next steps
167218

168219
Once you have InfluxDB running in Docker, see the [Get started guide](/influxdb/v1/introduction/get-started/) to:
220+
169221
- Create databases
170222
- Write and query data
171-
- Learn InfluxQL basics
223+
- Learn InfluxQL basics

0 commit comments

Comments
 (0)