If I try to run a RabbitMq image using the testcontainers-c library, it does not run and exits with the following error:
#include <stdio.h>
#include <unistd.h>
#include "testcontainers-c.h"
#define RABBITMQ_IMAGE "rabbitmq:3.12.11-management-alpine"
int main() {
printf("Using RabbitMq with the Testcontainers C binding:\n");
printf("Creating new container: %s\n", RABBITMQ_IMAGE);
int requestId = tc_new_container_request(RABBITMQ_IMAGE);
tc_with_exposed_tcp_port(requestId, 5672);
tc_with_exposed_tcp_port(requestId, 15672);
struct tc_run_container_return ret = tc_run_container(requestId);
int containerId = ret.r0;
if (!ret.r1) {
printf("Failed to run the container: %s\n", ret.r2);
return -1;
}
printf("Launched container with ID: %d\n", containerId);
sleep(5);
char * logs = tc_get_container_log(containerId);
printf("Received logs: %s\n", logs);
return 0;
}
Would this be a problem of the testcontainers-go library, or perhaps how its being invoked? It would be nice to be able to use the C library to run a RabbitMQ image to run tests.
Also, here is the output of the C program above when running it on my machine (openSUSE Leap 15.6 host):
Using RabbitMq with the Testcontainers C binding:
Creating new container: rabbitmq:3.12.11-management-alpine
2024/07/09 14:37:52 github.com/testcontainers/testcontainers-go - Connected to docker:
Server Version: 24.0.7-ce
API Version: 1.43
Operating System: openSUSE Leap 15.6
Total Memory: 64013 MB
2024/07/09 14:37:52 ๐ณ Creating container for image docker.io/testcontainers/ryuk:0.5.1
2024/07/09 14:37:52 โ
Container created: 9c5655466cbe
2024/07/09 14:37:52 ๐ณ Starting container: 9c5655466cbe
2024/07/09 14:37:52 โ
Container started: 9c5655466cbe
2024/07/09 14:37:52 ๐ง Waiting for container id 9c5655466cbe image: docker.io/testcontainers/ryuk:0.5.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2024/07/09 14:37:52 ๐ณ Creating container for image rabbitmq:3.12.11-management-alpine
2024/07/09 14:37:52 โ
Container created: ffe15b2ab23c
2024/07/09 14:37:52 ๐ณ Starting container: ffe15b2ab23c
2024/07/09 14:37:53 โ
Container started: ffe15b2ab23c
Launched container with ID: 0
Received logs: /usr/local/bin/docker-entrypoint.sh: line 50: exec: : not found