AbdBarho / stable-diffusion-webui-docker

Easy Docker setup for Stable Diffusion with user-friendly UI
Other
6.79k stars 1.14k forks source link

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 8: unknown instruction: cat (did you mean cmd?) #190

Closed pennpeng closed 1 year ago

pennpeng commented 2 years ago

Error:

# docker compose  --profile auto  up --build  
[+] Building 16.4s (6/6) FINISHED                                                                                                                                                                                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                                 0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                      0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                                                                                                                                                                                                                                                                          15.3s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2                                                                                                                                                                                                                                      0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 8: unknown instruction: cat (did you mean cmd?)

docker version

# docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.12.2)
  scan: Docker Scan (Docker Inc., v0.21.0)

Server:
 Containers: 62
  Running: 26
  Paused: 0
  Stopped: 36
 Images: 85
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 1

docker compose version:

 compose*    Docker Compose (Docker Inc., v2.12.2)
pennpeng commented 2 years ago
# docker compose --profile hlky  up --build
[+] Building 16.4s (6/6) FINISHED                                                                                                                                                                                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                                 0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                      0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                                                                                                                                                                                                                                                                          15.3s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2                                                                                                                                                                                                                                      0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                    0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 18: unknown instruction: git
AbdBarho commented 2 years ago

it seems that your docker is not picking up on the new syntax features, can you try with

DOCKER_BUILDKIT=1 docker compose --profile auto up --build  

?

pennpeng commented 2 years ago

I reboot system,same problem:

r# DOCKER_BUILDKIT=1 docker compose --profile auto up --build  
[+] Building 16.1s (6/6) FINISHED                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                 0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                      0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                                                                                                          15.2s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2                                                                      0.0s
 => [internal] load .dockerignore                                                                                                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                 0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 8: unknown instruction: cat (did you mean cmd?)
AbdBarho commented 2 years ago

why does it take 15 seconds to resolve the config?

 => resolve image config for docker.io/docker/dockerfile:1              15.2s

are you running offline? using a proxy? docker is probably unable to resolve the config, which is the reason why it does not work?

can you try to pull the syntax image first?

docker pull docker/dockerfile:latest

mine looks like this:

$ docker pull docker/dockerfile:latest
latest: Pulling from docker/dockerfile
1328b32c40fc: Already exists
Digest: sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc
Status: Downloaded newer image for docker/dockerfile:latest
docker.io/docker/dockerfile:latest
s524797336 commented 2 years ago

It is a Docker+wsl bug related to this issue https://github.com/docker/for-win/issues/11261

s524797336 commented 2 years ago

Try edit file (~/.docker/config.json) to {"_credsStore":"desktop.exe"}

xiangcp commented 2 years ago

`

docker compose --profile auto up --build

[+] Building 15.6s (6/6) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => resolve image config for docker.io/docker/dockerfile:1 15.3s => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2 0.0s => [internal] load .dockerignore 0.0s => [internal] load build definition from Dockerfile 0.0s failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 8: unknown instruction: cat (did you mean cmd?) ` I also got the same problem while reinstalling, my system is centos, docker and docker compose are both latest versions

raysworld commented 1 year ago

I am not quite sure why this is happening, but this problem is solved for me, as a temporary solution, with the following changes: 1. navigate to /services/[auto/hlky] folder 2. open Dockerfile with your text editor 3. navigate to every RUN command that break to several lines, e.g.

RUN <<EOF 
cat <<'EOE' > /clone.sh 
mkdir -p repositories/"$1" xxxxx <code ommited>
EOE 
EOF

4. add \ to the end of each of these lines, that is

RUN <<EOF  \
cat <<'EOE' > /clone.sh \
mkdir -p repositories/"$1" xxxxx <code ommited> \
EOE \
EOF

Regarding to this post, the Dockerfile uses BuildKit to build multi-line command and should include a shebang # syntax=docker/dockerfile:1.3-labs as the very first line and then build with the environment variable DOCKER_BUILDKIT=1

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.

dhlsam commented 1 year ago

root@Tower:/mnt/user/AI/stable-diffusion-webui# DOCKER_BUILDKIT=1 docker compose --profi le auto up --build
[+] Building 15.4s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 147B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => resolve image config for docker.io/docker/dockerfile:1 15.2s => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b 0.0s => [internal] load .dockerignore 0.0s => [internal] load build definition from Dockerfile 0.0s failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfi le.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = docker file parse error on line 8: unknown instruction: cat (did you mean cmd?)

root@Tower:/mnt/user/AI/stable-diffusion-webui# docker info Client:
Context: default
Debug Mode: false
Plugins:
compose: Docker Compose (Docker Inc., v2.11.2)

Server:
Containers: 12
Running: 5
Paused: 0
Stopped: 7
Images: 12
Server Version: 20.10.21
Storage Driver: btrfs
Build Version: Btrfs v5.10.1
Library Version: 102
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 1c90a442489720eec95342e1789ee8a5e1b9536f
runc version: v1.1.4-0-g5fd4c4d1
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.19.17-Unraid
Operating System: Slackware 15.0 x86_64 (post 15.0 -current)
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 31.03GiB
Name: Tower
ID: DAWC:3MPX:TD7V:AAU2:5GLP:V52W:NHRY:XPYN:AVVU:Z653:OHAC:PBT6
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://vpqrpagf.mirror.aliyuncs.com/
Live Restore Enabled: false
Product License: Community Engine

got same message

AbdBarho commented 1 year ago

@dhlsam my plugins are as follows:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.14.1)
  scan: Docker Scan (Docker Inc., v0.23.0)

buildx is missing in your setup.

dhlsam commented 1 year ago

@dhlsam my plugins are as follows:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.14.1)
  scan: Docker Scan (Docker Inc., v0.23.0)

buildx is missing in your setup.

I am running unriad with docker compose, I try to edit docker file # syntax=docker/dockerfile:1.3-labs, works with DOCKER_BUILDKIT=1 docker compose --profile auto up --build

AbdBarho commented 1 year ago

@dhlsam can you try to restore the original syntax, but run this command before you build:

docker pull docker/dockerfile:latest

?

dhlsam commented 1 year ago

@dhlsam can you try to restore the original syntax, but run this command before you build:

docker pull docker/dockerfile:latest

?

root@Tower:/mnt/user/appdata/stable-diffusion-webui# docker pull docker/dockerfile:latest latest: Pulling from docker/dockerfile 24a639a53085: Already exists Digest: sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2 Status: Downloaded newer image for docker/dockerfile:latest docker.io/docker/dockerfile:latest root@Tower:/mnt/user/appdata/stable-diffusion-webui# docker compose --profile auto up --build [+] Building 15.4s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 216B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => resolve image config for docker.io/docker/dockerfile:1 15.2s => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2 0.0s => [internal] load .dockerignore 0.0s => [internal] load build definition from Dockerfile 0.0s failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 8: unknown instruction: cat (did you mean cmd?)

it doesn't work

jmliu88 commented 1 year ago

~I am not quite sure why this is happening, but this problem is solved for me, as a temporary solution, with the following changes:~ ~1. navigate to /services/[auto/hlky] folder~ ~2. open Dockerfile with your text editor~ ~3. navigate to every RUN command that break to several lines, e.g.~

RUN <<EOF 
cat <<'EOE' > /clone.sh 
mkdir -p repositories/"$1" xxxxx <code ommited>
EOE 
EOF

~4. add \ to the end of each of these lines, that is~

RUN <<EOF  \
cat <<'EOE' > /clone.sh \
mkdir -p repositories/"$1" xxxxx <code ommited> \
EOE \
EOF

Regarding to this post, the Dockerfile uses BuildKit to build multi-line command and should include a shebang # syntax=docker/dockerfile:1.3-labs as the very first line and then build with the environment variable DOCKER_BUILDKIT=1

Changing the shebang from # syntax=docker/dockerfile:1 to # syntax=docker/dockerfile:1.3-labs works for me. Thanks!