compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] Using docker-compose with Windows Containers and dockerfile_inline does not work (is ignored)

Open sikhness opened this issue 1 year ago • 2 comments

Description

When I'm using docker-compose for Windows containers (specifically on Windows Server 2022), if I define a compose file that has dockerfile_inline set, it just seems to ignore it and throws the following error:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: CreateFile C:\Users\Administrator\Documents\Docker Config\Windows\Test\Dockerfile: The system cannot find the file specified.

Here is the example docker-compose file that I am using:

services:
  test:
    container_name: test
    image: test:latest
    build:
      dockerfile_inline: |
        FROM mcr.microsoft.com/windows/server:ltsc2022
        RUN powershell.exe
    restart: unless-stopped
    networks:
      - test
    hostname: test

networks:
  test:
    name: test

Steps To Reproduce

  1. Create a docker-compose.yml file with the contents from the description above.
  2. Run docker-compose up -d
  3. Error will be thrown as shown above from the description.

Compose Version

Docker Compose version v2.27.0

Docker Environment

Client:
 Version:    26.1.1
 Context:    default
 Debug Mode: false

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 17
 Server Version: 26.1.1
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
 Swarm: inactive
 Default Isolation: process
 Kernel Version: 10.0 20348 (20348.1.amd64fre.fe_release.210507-1500)
 Operating System: Microsoft Windows Server Version 21H2 (OS Build 20348.2402)
 OSType: windows
 Architecture: x86_64
 CPUs: 16
 Total Memory: 29.72GiB
 Name: HOME-SERVER
 ID: a1bfc379-859d-43aa-b16d-d200ae9a6ba8
 Docker Root Dir: C:\ProgramData\docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Anything else?

No response

sikhness avatar May 12 '24 23:05 sikhness

Has here been any news on this bug?

sikhness avatar Jul 01 '24 20:07 sikhness

I wanted to make a note that even with the latest v2.29.1 version of docker compose, the issue is still happening with Windows Containers where dockerfile_inline just does not work.

sikhness avatar Aug 15 '24 20:08 sikhness

Using v2.29.2 for linux x64 (fedora) and can confirm this issue is not only for windows. context defaults to . and docker-compose expects Dockerfile not using dockerfile_inline.

Any update on this?

loeffelpan avatar Sep 08 '24 14:09 loeffelpan

Hello, @sikhness and @loeffelpan

First of all, sorry for the late reply. It can be difficult for the team to get time to review all issues in compose.

This seems an issue related with buildx. On compose side we are just passing the content of dockerfile_inline to buildx. Could you please create an issue in buildx repo and link to this one?

If for some any reason it makes sense to re-open this issue, please feel free to do so :) Thank you so much for your contributions!

jhrotko avatar Oct 10 '24 14:10 jhrotko

In my case I'm using podman compose with docker-compose as a provider. podman buildx version gives me a version info of buildah.

First: It wouldn't make any sense to file an issue for buildx from my side. Second: It's unlikely an buildx-issue when this occurs also with podman and buildah, isn't it?

loeffelpan avatar Oct 10 '24 15:10 loeffelpan