Run docker images on windows agent of github

Viewed 119

I'm having trouble using github actions to test my project as it has to run on windows and I need to use databases to test it.

I have the YAML below to start the database using docker. As the project is a ORM extension so I need to actually test it against the database in some cases without mocking it so I can validate if it's really working.

If I run it on a linux agent it works. If I run on my laptop using Docker for Windows and WSL it also works but it's not working on windows agent on github.

The usernames and passwords were removed from the example, of course

version: '3.1'

services:

  mariadb:
    image: mariadb:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: <password>
      MYSQL_DATABASE: dapperTest
      MYSQL_USER: <username>
      MYSQL_PASSWORD: <password>
    ports:
      - 3306:3306
      - 33306:3306

  mariadbadminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

  oracle-db:
    image: oracleinanutshell/oracle-xe-11g:latest
    restart: always
    environment:
      ORACLE_CHARACTERSET: AL32UTF8
      ORACLE_ALLOW_REMOTE: 1
      ORACLE_DISABLE_ASYNCH_IO: 1
      ORACLE_ENABLE_XDB: 1
    ports:
      - 51521:1521
      - 1521:1521 
  
  sqlserver:
    image: mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
    restart: always
    environment:
      ACCEPT_EULA: Y
      SA_PASSWORD: <password>
    ports:
      - 1433:1433
      
  db2:
    image: ibmcom/db2
    restart: always
    privileged: true
    environment:
      LICENSE: accept
      DB2INSTANCE: db2inst1
      DB2INST1_PASSWORD: <password>
      DBNAME: testdb
      BLU: 0
      ENABLE_ORACLE_COMPATIBILITY: 0
      TO_CREATE_SAMPLEDB: 0
      REPODB: 0
      IS_OSXFS: 0
      HADR_ENABLED: 0
    ports:
      - 50000:50000
      - 55001:55000

In the scenario above I get this error:

latest: Pulling from library/mariadb
no matching manifest for windows/amd64 10.0.17763 in the manifest list entries

So I tried to include platform tag on my YAML like this

version: '3.1'

services:

  mariadb:
    image: mariadb:latest
    restart: always
    platform: linux
    environment:
      MYSQL_ROOT_PASSWORD: <password>
      MYSQL_DATABASE: dapperTest
      MYSQL_USER: <username>
      MYSQL_PASSWORD: <password>
    ports:
      - 3306:3306
      - 33306:3306

The result is this with platform: linux or platform: linux/amd64:

Creating network "docker_default" with the default driver
Pulling mariadb (mariadb:latest)...
unsupported os linux

What I also tried to build the image using DockerFiles like this:

version: '3.1'

services:

  mariadb:
    build:
        context: ./mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: <password> 
      MYSQL_DATABASE: dapperTest
      MYSQL_USER: <username>
      MYSQL_PASSWORD: <password>
    ports:
      - 3306:3306
      - 33306:3306

  adminer:
    build:
        context: ./adminer
    restart: always
    ports:
      - 8080:8080

  oracle-db:
    build:
        context: ./oracle
    restart: always
    environment:
      ORACLE_CHARACTERSET: AL32UTF8
      ORACLE_ALLOW_REMOTE: 1
      ORACLE_DISABLE_ASYNCH_IO: 1
      ORACLE_ENABLE_XDB: 1
    ports:
      - 51521:1521
      - 1521:1521 
  
  sqlserver:
    build:
        context: ./sqlserver
    restart: always
    environment:
      ACCEPT_EULA: Y
      SA_PASSWORD: <password>
    ports:
      - 1433:1433
      
  db2:
    build:
        context: ./db2
    restart: always
    privileged: true
    environment:
      LICENSE: accept
      DB2INSTANCE: db2inst1
      DB2INST1_PASSWORD: <password>
      DBNAME: testdb
      BLU: 0
      ENABLE_ORACLE_COMPATIBILITY: 0
      TO_CREATE_SAMPLEDB: 0
      REPODB: 0
      IS_OSXFS: 0
      HADR_ENABLED: 0
    ports:
      - 50000:50000
      - 55001:55000

DockerFiles are basically the same only changing the image name:

FROM  --platform=linux mariadb:latest

The result with this change:

Creating network "docker_default" with the default driver
Building mariadb
Sending build context to Docker daemon  2.048kB

unsupported os linux
Step 1/1 : FROM  --platform=linux mariadb:latest
Service 'mariadb' failed to build : Build failed

Using linux/amd64

Creating network "docker_default" with the default driver
Building mariadb
Sending build context to Docker daemon  2.048kB

Step 1/1 : FROM  --platform=linux/amd64 mariadb:latest
unsupported os linux
Service 'mariadb' failed to build : Build failed

Does anybody knows how to make these images to run on docker using windows agent in github?

0 Answers
Related