apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.61k stars 13.81k forks source link

Dockerfile parse error line 40: Unknown flag: mount #29983

Open gopi-s-ht opened 2 months ago

gopi-s-ht commented 2 months ago

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

dosubot[bot] commented 2 months ago

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:

  1. Set the Environment Variable: Ensure that the DOCKER_BUILDKIT environment variable is set to 1 in your current shell session:

    export DOCKER_BUILDKIT=1
  2. 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
  3. 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.

mistercrunch commented 2 months ago

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.

gopi-s-ht commented 2 months ago

@mistercrunch

Docker version 26.1.4, build 5650f9b

Docker Compose version v2.29.2
mistercrunch commented 2 months ago

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

mistercrunch commented 2 months ago

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.

mistercrunch commented 2 months ago

@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.

mistercrunch commented 2 months ago

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.

ReDxDaGer commented 2 months ago

@gopi-s-ht

To reolve you can try some of these steps :-