Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The dockerfile_inline field does not take effect #10456

Closed
Zacama opened this issue Apr 11, 2023 · 6 comments
Closed

[BUG] The dockerfile_inline field does not take effect #10456

Zacama opened this issue Apr 11, 2023 · 6 comments
Assignees
Labels

Comments

@Zacama
Copy link

Zacama commented Apr 11, 2023

Description

I try to use dockerfile_inline field. But when I execute docker compose build command, it reports error.

[+] Building 0.1s (2/2) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 94B 0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /docker_data/tmp/buildkit-mount170211851/Dockerfile: no such file or directory

So I added the dockerfile field and specified a file that does not exist to see what happens to the error. It reports an error that the file does not exist.

[+] Building 0.0s (2/2) FINISHED
=> [internal] load build definition from test 0.0s
=> => transferring dockerfile: 2B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 94B 0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /docker_data/tmp/buildkit-mount040376266/test: no such file or directory

Steps To Reproduce

  1. May be any environment
  2. compose.yml

services:
base-image:
image: base:0.1
build:
context: .
dockerfile_inline: |
FROM node:19.8.1
RUN echo "yeah!"

  1. docker compose build --pull --no-cache base-image
  2. Then you can get that error.

Compose Version

Docker Compose version v2.17.2

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., v2.17.2)

Server:
 Containers: 332
  Running: 238
  Paused: 0
  Stopped: 94
 Images: 344
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 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.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1062.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 32
 Total Memory: 62.76GiB
 Name: node-1
 ID: W6TG:YMF7:CG3O:3O5Z:27EB:YV4M:E47K:UEE3:RMHR:CLCJ:FBGL:P2G7
 Docker Root Dir: /docker_data
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Anything else?

No response

@Zacama Zacama changed the title [BUG] dockerfile_inline not active [BUG] The dockerfile_inline field does not take effect Apr 11, 2023
@milas milas self-assigned this Apr 11, 2023
@milas
Copy link
Contributor

milas commented Apr 11, 2023

Field was unusable - missing Go struct tag meant the name was wrong and inaccessible in YAML. Fix in compose-spec/compose-go#386. We're planning on tagging a new version of the library for the next Compose release, so the fix should be included with that.

@Zacama
Copy link
Author

Zacama commented Apr 12, 2023

Ok, thank you very much~ : )

@muradm
Copy link

muradm commented Apr 27, 2023

While compose-spec/compose-go#386 seems like in, still not working?

Docker Compose version v2.17.3
docker stack deploy -c docker-compose.yml stack1
services.db.build Additional property dockerfile_inline is not allowed
version: '3'

services:
  db:
    build:
      context: .
      dockerfile_inline: |
        FROM mariadb:10.11.2-jammy
        RUN echo 'Hello'

@Zacama
Copy link
Author

Zacama commented Apr 28, 2023

I don't know much about stack, maybe this syntax is only supported on docker compose v2? @muradm

@ndeloof
Copy link
Contributor

ndeloof commented Apr 28, 2023

@muradm docker stack deploy is not docker compose, this is a separate codebase and doesn't even use the same compose file parsing code (while those share some history). see docker/cli#2527

@ndeloof
Copy link
Contributor

ndeloof commented Apr 28, 2023

confirmed this is fixed in 2.17.3

@ndeloof ndeloof closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants