docker / docker/buildx

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

Open
#2,737 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/bake area/bake/compose area/windows status/needs-investigation
Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

Contributing guidelines
I've found a bug and checked that ...
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem
Description

I originally created this issue here in the compose repository, and I was told to re-open the issue here since compose is just passing through the content of dockerfile_inline to buildx.

Let me describe the issue in detail here as well:
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
Expected behaviour

Docker should be using the content of dockerfile_inline to build the image instead of looking for a Dockerfile specifically

Actual behaviour

Docker looks for a Dockerfile in the directory structure instead as shown in 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.
Buildx version

This command doesn't resolve (is no buildx installed on Windows Server)?

Docker info

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

Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 18
Server Version: 27.2.0
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.2655)
OSType: windows
Architecture: x86_64
CPUs: 16
Total Memory: 79.72GiB
Name: HOME-SERVER
ID: 4c099b0a-063e-4e68-a9ab-df005617efb5
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

Builders list

This command doesn't resolve (is no buildx installed on Windows Server)? If not, is this a requirement for dockerfile_inline to work and how do we set it up on Windows Server?

Configuration

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

Build logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided docker-compose configuration on Windows Server 2022 and verify whether buildx is available, using the reported Docker info and error as checkpoints. Trace how docker-compose passes dockerfile_inline to buildx; done means the inline content is used to build the Windows image without requiring a Dockerfile path.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
build-system, devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.