Dockerfile parse error line 40: Unknown flag: mount
Bug description
I am following the steps mentioned in here. when using docker compose up, I am getting the error as below.
[root@XXXXXXXX superset]# docker-compose -f docker-compose-non-dev.yml up
WARN[0000] /ebs/superset/docker-compose-non-dev.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Building 0.1s (7/8) docker:default
=> [superset-worker-beat internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 7.17kB 0.0s
=> [superset-worker-beat internal] load .dockerignore 0.0s
=> => transferring context: 92B 0.0s
=> [superset-worker internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 89B 0.0s
=> [superset-worker internal] load .dockerignore 0.1s
=> => transferring context: 1.32kB 0.0s
=> CANCELED [superset-init internal] load .dockerignore 0.0s
=> => transferring context: 1.32kB 0.0s
=> CANCELED [superset-init internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 7.17kB 0.0s
=> CANCELED [superset internal] load .dockerignore 0.0s
=> => transferring context: 1.32kB 0.0s
=> CANCELED [superset internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 7.17kB 0.0s
failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: Dockerfile parse error line 40: Unknown flag: mount
[root@XXXXXXXX superset]#
]# docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
default* docker
\_ default \_ default running v0.6.4+396bfe2 linux/amd64, linux/386
Tried exporting DOCKER_BUILDKIT=1 before running docker compose, still getting the same error.
I am using AWS EC2 instance size r5.large
Docker version: Docker version 26.1.4, build 5650f9b
OS: NAME="Amazon Linux" VERSION="2023" ID="amzn" ID_LIKE="fedora" VERSION_ID="2023" PLATFORM_ID="platform:al2023" PRETTY_NAME="Amazon Linux 2023.3.20240312" ANSI_COLOR="0;33" CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023" HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/" DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/" SUPPORT_URL="https://aws.amazon.com/premiumsupport/" BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023" VENDOR_NAME="AWS" VENDOR_URL="https://aws.amazon.com/" SUPPORT_END="2028-03-15"
How to reproduce the bug
git clone --depth=1 https://github.com/apache/superset.git cd superset docker-compose -f docker-compose-non-dev.yml pull docker-compose -f docker-compose-non-dev.yml up
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Hey there, @gopi-s-ht! I'm a bot designed to help you with bugs, questions, and contributions. Feel free to ask for assistance while waiting for a human maintainer.
To resolve the Dockerfile parse error "Unknown flag: mount" on line 40 when running docker-compose -f docker-compose-non-dev.yml up for Apache Superset on an AWS EC2 instance with Amazon Linux 2023 and Docker version 26.1.4, you need to ensure that BuildKit is enabled. The --mount flag is supported in BuildKit, which is not enabled by default in some Docker installations.
You mentioned that you tried exporting DOCKER_BUILDKIT=1 but still encountered the same error. Here are a few additional steps to ensure BuildKit is properly enabled:
-
Set the Environment Variable: Ensure that the
DOCKER_BUILDKITenvironment variable is set to1in your current shell session:export DOCKER_BUILDKIT=1 -
Verify Docker Configuration: Check if BuildKit is enabled in your Docker configuration file (
/etc/docker/daemon.json). If not, add the following configuration:{ "features": { "buildkit": true } }After making changes, restart the Docker service:
sudo systemctl restart docker -
Run Docker Compose: Now, try running the Docker Compose command again:
docker-compose -f docker-compose-non-dev.yml up
If the issue persists, you can use an alternative Docker Compose configuration that does not rely on the --mount flag. The Superset repository provides several configurations, including docker-compose-image-tag.yml, which fetches and runs pre-built images from Docker Hub:
export TAG=3.1.1
docker-compose -f docker-compose-image-tag.yml up
This approach avoids the --mount flag and should work without requiring BuildKit.
For more details, you can refer to the Superset documentation on Docker Compose configurations [1][2].
To continue talking to Dosu, mention @dosu.
My guess is that this is a docker / docker-compose version issue, please find the version you use, report back here (so we get a better understanding of what versions don't work), upgrade and retry.
@rusackas maybe we should merge this -> https://github.com/apache/superset/pull/29609, this way we can instruct people to run it, and tweak/adjust the known version ranges that work or don't work based on what contributors report in issues like this one.
@mistercrunch
Docker version 26.1.4, build 5650f9b
Docker Compose version v2.29.2
Oh looks like you're ahead of me, let me upgrade locally and run docker-compose build; docker-compose -f docker-compose-non-dev.yml up
I had to docker volume rm superset_db_home for unrelated reasons, but docker-compose build; docker-compose -f docker-compose-non-dev.yml up worked for me.
@dosu-bot can you provide some instructions about nuking docker cache and anything else that might be getting in the way here? It's a dev environment so it should be safe to reset things.
Sorry I couldn't help, but at least I upgrade my local docker setup - there are cool new features in how docker-compose integrates better with docker-desktop now.
@gopi-s-ht
To reolve you can try some of these steps :-
- Update Docker and Docker Compose: Ensure you're using the latest versions of Docker and Docker Compose, as newer versions support more features.
- Enable BuildKit: You can enable BuildKit by setting an environment variable before running docker-compose:
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
- Or you can also use some older version of docker if that helps
- And do check the file once and verify if all the services are provided or not
This has been silent for a very long time, and much in docker-land has been changed since then. I'll close this as stale for now, but holler if it needs a revisit in the current codebase state.