If you’re wondering how to extend an Apache Superset image, to get additional features this guide is for you.
To extend the image such as including additional database drivers create a docker file named Dockerfile. Enter the details of the packages to be installed.
- To begin from the working directory on your server. Using your editor of choice create a “Dockerfile” and include the following contents.
- Be sure to declare at the head of the file, the image to be installed from, for example “FROM apache/superset:2.1.0”.
- Switch to root user before installing using “USER root”.
- Install packages, for example “RUN pip install mysqlclient”.
- Switch back to superset user after installation using “USER superset”.
- Save and exit the editor.
- Build the new image using “docker build . -t <name>:<tag>”. For example, “docker build . -t myl/superset:2.1.0”.
- Deploy the new image using docker run or docker compose.
There are other ways to accomplish extending an image. Sometimes a bit of creativity is what’s needed. You can try editing a running container, which isn’t a recommended option because you can lose your changes when the container is stopped or risk breaking the file system. To edit a running container, enter the file system using the “docker exec” command. Follow MYL for more tips.