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

Add withPlatform() method to GenericContainer #773

Closed
timbrinded opened this issue Jun 6, 2024 · 0 comments · Fixed by #806
Closed

Add withPlatform() method to GenericContainer #773

timbrinded opened this issue Jun 6, 2024 · 0 comments · Fixed by #806
Labels
enhancement New feature or request

Comments

@timbrinded
Copy link

Expected Behaviour
I want to be able to specify platform so I can run linux/amd64 images on apple mac without issues.

Most images have both amd64 & arm64 flavours, but i'd like to be able to specify platform for the times where only x86 is available.

Actual Behaviour
I get errors because an image can't be pulled for the current host platform architecture. This is analagous with running docker pull moonsonglabs/storage-hub on an Apple Silicon device.

Testcontainer Logs

/Users/timbo/workspace/personal/test-repro-testcontainers/node_modules/.pnpm/[email protected]/node_modules/docker-modem/lib/modem.js:343
      var msg = new Error(
                ^

Error: (HTTP code 404) unexpected - no match for platform in manifest: not found
    at /Users/timbo/workspace/personal/test-repro-testcontainers/node_modules/.pnpm/[email protected]/node_modules/docker-modem/lib/modem.js:343:17
    at IncomingMessage.<anonymous> (/Users/timbo/workspace/personal/test-repro-testcontainers/node_modules/.pnpm/[email protected]/node_modules/docker-modem/lib/modem.js:370:9)
    at IncomingMessage.emit (node:events:531:35)
    at IncomingMessage.emit (node:domain:488:12)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  reason: undefined,
  statusCode: 404,
  json: null
}

Steps to Reproduce

Have a go with the snippet on an apple mac:

import { GenericContainer } from "testcontainers";

async function main() { const container =await  new GenericContainer("moonsonglabs/storage-hub")
.start();
console.log("Started")

await new Promise(resolve=> setTimeout(resolve, 60000));
container.stop();
}

main()

Caution

Error thrown: Error: (HTTP code 404) unexpected - no match for platform in manifest: not found

Note

I have tried to workaround this with DOCKER_DEFAULT_PLATFORM but this doesn't make a difference.

Environment Information

  • Operating System: macOS 14.4.1
  • Docker Version: 26.1.1
  • Node version: 21.x
  • Testcontainers version: 10.9.0
@timbrinded timbrinded changed the title Add withPlatform() arg GenericContainer Add withPlatform() method to GenericContainer Jun 6, 2024
@cristianrgreco cristianrgreco added the enhancement New feature or request label Jun 10, 2024
weyert added a commit to weyert/testcontainers-node that referenced this issue Jul 28, 2024
Adds the ability to the pass `--platform`-argument for the docker container

refs testcontainers#773
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants