YugabyteDB Docker image

create a YugabyteDB Docker image with custom uid / gid

The default YugabyteDB Docker image from Docker Hub runs the database as a root user.

I need to run it as a non-root user and there is no release Docker image Dockerfile available in YugabyteDB repositories.

So I’ve created my own and here it is.

To build the image, run this command:

1
2
3
4
curl --silent https://gist.githubusercontent.com/radekg/3f749cba86e91a8c88eb0e88c8b8754c/raw > Dockerfile
docker build -t yb-test:latest .
...
 => => naming to docker.io/library/yb-test:latest

Start the container:

1
docker run --rm -ti yb-test:latest bash

Run this in the the container to start the cluster:

1
[myybuser@0fb8cfa7c3d0 /]$ yugabyted start

The output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
Starting yugabyted...
✅ System checks

+--------------------------------------------------------------------------------------------------+
|                                            yugabyted                                             |
+--------------------------------------------------------------------------------------------------+
| Status              : Running. Leader Master is present                                          |
| Web console         : http://127.0.0.1:7000                                                      |
| JDBC                : jdbc:postgresql://127.0.0.1:5433/yugabyte?user=yugabyte&password=yugabyte  |
| YSQL                : bin/ysqlsh   -U yugabyte -d yugabyte                                       |
| YCQL                : bin/ycqlsh   -u cassandra                                                  |
| Data Dir            : /home/myybuser/var/data                                                    |
| Log Dir             : /home/myybuser/var/logs                                                    |
| Universe UUID       : c9e704e3-ff8b-46df-8921-6c5bbd6de2f8                                       |
+--------------------------------------------------------------------------------------------------+
🚀 yugabyted started successfully! To load a sample dataset, try 'yugabyted demo'.
🎉 Join us on Slack at https://www.yugabyte.com/slack
👕 Claim your free t-shirt at https://www.yugabyte.com/community-rewards/

That’s about it.