Create a Persistent Tableau Server Docker Container in 30 minutes
This is a quick post with the step-by-step I used with a client to quickly create a persistent Tableau Server container image for testing purposes. The whole process takes roughly 30 minutes.
This post is not meant to teach you how to create this at scale and in a “production-capacity”, but rather how to jump-start your first attempt. It was tested on both Amazon Linux 2 and Ubuntu (including Ubuntu on WSL!). Do check Tableau’s official documentation to understand all options and best practices, as well as toubleshooting tips.
If you are new to Tableau Server running on Containers, check out this blog post by Bernhard Damberger.
Pre-requisites:
- A linux machine you can use to build the container image. I have tested on both Amazon Linux 2 (RHEL/CENTOS based) and Ubuntu (incl. Ubuntu on Windows Subsystem for Linux — thanks Tim Payne!).
- Docker is installed and running on that machine
- A valid Tableau Server license
- ssh there and download the following:
- Tableau Server (.rpm) installer, e.g. tableau-server-<version>.x86_64.rpm. Note: .deb installer not supported, because the base image inside the container is Centos7. But you can still create and run images on Ubuntu for example :D
- Tableau Server Container Builder tool , e.g. tableau-server-container-setup-tool-<version>.tar.gz
- Whatever database drivers you need, you can find them all here: https://www.tableau.com/support/drivers (Linux/64-bit)
- Mysql odbc driver: https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.26-1.el7.x86_64.rpm . Note: Make sure these drivers are compatible with RHEL7, not RHEL8 (not supported as of Sep 2021).
- PostgreSQL jdbc driver: https://downloads.tableau.com/drivers/linux/postgresql/postgresql-42.3.3.jar
Build the container:
- Uncompress the Container builder tool:
tar -xzf tableau-server-container-setup-tool-<VERSION>.tar.gz
2. Navigate to the new builder tool root folder and copy the drivers (.jar and .rpm) to the customer-files sub-folder
3. Copy Tableau Server installer .rpm to the Builder tool root folder
4. Edit the registration file (e.g. vi reg-file.json), which something like this (you must accept the eula):
{
"first_name" : "John",
"last_name" : "Smith",
"email" : "john.smith@example.com",
"company" : "Example, Inc",
"title" : "Head Cat Herder",
"department" : "Engineering",
"industry" : "Finance",
"company_employees" : "500",
"phone" : "123-555-1212",
"city" : "Kirkland",
"state" : "WA",
"zip" : "98034",
"country" : "United States",
"opt_in" : "true",
"eula" : "accept"
}
5. Let’s customize the Builder tool to install the db drivers, by editing the setup script (e.g. vi customer-files/setup-script)
#!/bin/bash
# Driver installation and other artifact installation script
mkdir -p /opt/tableau/tableau_driver/jdbccp /docker/customer-files/postgresql-42.3.3.jar /opt/tableau/tableau_driver/jdbc/postgresql-42.3.3.jaryum install -y /docker/customer-files/mysql-connector-odbc-8.0.26-1.el7.x86_64.rpm
Note that everything you copied to the local customer-files folder, will be copied to the container image's equivalent folder /docker/customer-files by the builder tool
6. Optionally, set up some variables. I’m going to set the tableau admin username and pw, as well as a remote tsm user, so I can access the TSM GUI from my normal laptop (e.g. vi env.txt):
TABLEAU_USERNAME=admin
TABLEAU_PASSWORD=admin
TSM_REMOTE_UID=1010
TSM_REMOTE_USERNAME=tsmadmin
Note, you can use a password file and a proper pw, much more secure than the above, but for this quick test I don’t mind :)
7. Finally, create the Container Image!
./build-image --accepteula -i tableau-server-<VERSION>.rpm -e env.txt
8. Check that Docker really got a new image:
Note: if you don’t see the Repository Name or Tag, something went wrong on the build process, I’d not even try to use this image. For me, this happened when I tried to install mysql odbc driver version built for RHEL8.
Running the container
- Run this command to prepare the docker env that will be running the container:
sudo ./configure-container-host -u 999
2. Create a Docker volume to persist Tableau Server data (there are many ways to create persistency with docker, you can choose a different one if you like):
docker volume create ts_container_data
3. Set the password for the TSM Remote User by creating a secrets file (e.g. vi remote-user-secret). It must be called exactly like this. The contents of the file will be just the strong password:
my-craz1-sTrong-k€y-noOne-Can-gUes$
Important: It must be a strong one, otherwise initialization will fail!
4. Run the container image.
As this is the first run, we’ll specify the initial Tableau Server admin user and pw, as well as the TSM Remote user password via the secrets file created in the previous step.
You will also need your Tableau Server License Key and newly created container Image-id.
Additionaly, Tableau Server GUI runs on port 8080 (inside the container) by default, so I’m going to map this to 8080 outside. I’ll do the same with TSM GUI port 8850.
docker run \
-e LICENSE_KEY=<lincense-key> \
-e TABLEAU_USERNAME=admin \
-e TABLEAU_PASSWORD=admin \
-v ts_container_data:/var/opt/tableau \
-v <absolute-path>/remote-user-secret:/docker/config/remote-user-secret \
--hostname=localhost \
-p 8080:8080 \
-p 8850:8850 \
-d <container-image-id>
Note 1: you can get thecontainer-image-id
with the command “docker images”.
Note 2: replace the <absolute-path> and <lincense-key>
by your own values.
BE SUPER PATIENT, THIS WILL TAKE ~20 mins.
Note: If for any reason this first run fails and you need to kill the container and try again, remember to clear your persistent volume, as you probably got a corrupted installation there.
5. Monitor the status of this initialization/installation in different ways:
- Sign in to the TSM Gui via browser: https://<container-ip-address>:8850
- docker ps → show all running containers
- docker ps -a → show all containers
- docker logs <container-id> → did anything go wrong?
- docker stats → see all the cpu/mem/etc from the varius running containers. If Tableau Server is initializing, you will see a lot of activity here.
- docker exec -it <container-id> tsm status -v → check if Tableau is initializing or has initialized properly
- docker exec -it <container-id> bash → now you are logged on the console of the container, so you can run any linux command, e.g. tsm status or even install db drivers.
- docker exec -it <container-name> bash -c ‘cat $DATA_DIR/supervisord/run-tableau-server.log’ → this helps you check for errors during a fresh startup
- Other files and troubleshooting ideas here on Tableau’s official manual.
6. Confirm your Tableau Server is hopefully up-and-running:
7. Connect to Tableau Server from your laptop:
http://<ip-address>:8080
https://<ip-address>:8850
8. (optional) Check your persistent volume (this is what you mapped to your Tableau Server’s $DATA_DIR env value):
9. Re-starting the container image if you have stopped it (i.e not need to re-initialize it from scratch):
Whenever you start this container again, remember to mount the same persistent data volume and pass the same hostname as the previous run. Then, simply run it with:
docker run \
-v ts_container_data:/var/opt/tableau \
--hostname=localhost \
-p 8080:8080 \
-p 8850:8850 \
-d <container-image-id>
10. (Optional) You may also reset the TSM Remote User password in every subsequent start of the image. Simply change the secrets file locally (e.g. vi remote-user-secrets) and pass this file to the docker run command. Note: Remember expose the TSM internal port 8850 as well, so you can connect to it from your laptop’s browser.
docker run \
-v ts_container_data:/var/opt/tableau \
-v {absolute-path}/remote-user-secret:/docker/config/remote-user-secret \
--hostname=localhost \
-p 8080:8080 \
-p 8850:8850 \
-d <container-image-id>
Enjoy 🙂
Drop a comment below sharing your experience.