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

Question regarding passing arguments #658

Closed
TieyanFu opened this issue Sep 29, 2023 · 1 comment
Closed

Question regarding passing arguments #658

TieyanFu opened this issue Sep 29, 2023 · 1 comment
Labels
triage Investigation required

Comments

@TieyanFu
Copy link

Expected Behaviour
Referring to the previous issue, I'd like to pass also some parameters to a postgres docker container. However, when using the mentioned method, seems the API has changed from "withCmd" to "withCommand", and the results in following error

const postgresContainer = new GenericContainer('postgres:14.3-bullseye')
  .withUser('postgres')
  .withEnvironment({
    POSTGRES_PASSWORD: 'example',
    POSTGRES_DB: 'idmp',
  })
  .withExposedPorts(5432)
  //.withSharedMemorySize(1024 * 1024 * 1024)
  .withHealthCheck({
    test: ['CMD-SHELL', 'pg_isready'],
    interval: 5000,
    timeout: 1000,
    retries: 5,
  })
  .withCommand(["...", "-c", "shared_buffers=256MB"])

Actual Behaviour
...

Testcontainer Logs
testcontainers [DEBUG] [e045ff701ce2] Fetching container logs... +1ms
testcontainers [DEBUG] [e045ff701ce2] Demuxing stream... +4ms
testcontainers [DEBUG] [e045ff701ce2] Demuxed stream +1ms
testcontainers [DEBUG] [e045ff701ce2] Fetched container logs +0ms
testcontainers [DEBUG] [e045ff701ce2] Waiting for container to be ready... +0ms
testcontainers [DEBUG] [e045ff701ce2] Waiting for health check... +0ms
testcontainers [DEBUG] [e045ff701ce2] Inspecting container... +0ms
testcontainers:containers [e045ff701ce2] /usr/local/bin/docker-entrypoint.sh: line 341: exec: ...: not found +0ms
testcontainers [DEBUG] [e045ff701ce2] Inspected container +6ms
testcontainers [ERROR] [e045ff701ce2] Health check failed: unhealthy +0ms
testcontainers [ERROR] [e045ff701ce2] Container failed to be ready: Error: Health check failed: unhealthy +0ms
testcontainers [DEBUG] [e045ff701ce2] Stopping container... +0ms
testcontainers [DEBUG] [e045ff701ce2] Container already stopped +27ms
testcontainers [DEBUG] [e045ff701ce2] Removing container... +0ms

Environment Information

  • Operating System: MacOS 13.5.2
  • Docker Version: 4.1.1
  • Node version:
  • Testcontainers version: "10.2.1"
@cristianrgreco cristianrgreco added the triage Investigation required label Oct 4, 2023
@cristianrgreco
Copy link
Collaborator

Hi @TieyanFu, you are running this command:

.withCommand(["...", "-c", "shared_buffers=256MB"])

Note the .... Docker is returning this error:

testcontainers:containers [e045ff701ce2] /usr/local/bin/docker-entrypoint.sh: line 341: exec: ...: not found +0ms

Docker is telling you that the binary ... does not exist, which makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Investigation required
Projects
None yet
Development

No branches or pull requests

2 participants