compose: Cannot mix Windows and Linux containers in docker-compose.yml

Attempting to mix windows and linux containers in a single docker-compose.yml does not work.

Description of the issue

With the release of compose 1.21.0 I was expecting to be able to mix windows and linux containers.

Context information (for bug reports)

Windows 10 Version 1709 (OS Build 16299.371)
Docker Engine: 18.04.0-ce-win62 (17151)
Machine: 0.14.0
Compose: 1.21.0

Output of “docker-compose config”

services:
  mssql:
    image: microsoft/windowsservercore
  nginx:
    image: nginx-alpine
    platform: linux
version: '2.4'

Steps to reproduce the issue

  1. Switch to Windows containers
  2. Run docker-compose up

Observed result

Creating network "test_default" with the default driver
Pulling mssql (microsoft/windowsservercore:)...
latest: Pulling from microsoft/windowsservercore
ERROR: cannot download image with operating system "windows" when requesting "linux"

Expected result

Containers to be started.

Additional information

OS version / distribution, docker-compose install method, etc.

Using Edge install of Docker for Windows.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 15

Most upvoted comments

This should be re-opened, since 3.x does not yet implement it.

Good news! After updating to Windows 10 1803 17134.1 the following compose file is working:

version: '2.4'

services:
  mssql:
    image: microsoft/windowsservercore
    platform: windows
  nginx:
    image: nginx
    platform: linux

Yep - I’m seeing this as not working on Docker Engine 19.03.1 with a 3.7 compose file

Related: https://github.com/docker/compose/pull/5985#issuecomment-526349087

How can this work? “platform” is an unsupported option in docker-compose version 1.21.1, build 7641a569