I am doing a project where there is a benthos script that insert some data into a cassandra db, but during the execution, with a function, benthos call a python script , that create and populate the cassandra database.
I am trying building with docker:
- i need to install python and Benthos
- i need to install the python library for cassandra
- like cmd , to start the benthos script
docker-compose that create 3 different service:
- one for the db
- one for the Python script
- one for the Benthos script
dockerfile
FROM ubuntu:latest
WORKDIR /home
RUN apt-get update && apt-get upgrade -y &&
apt-get install -y python3 python3-pip python3-venv curl unzip &&
apt-get clean
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --upgrade pip
RUN pip install cassandra-driver
RUN curl -LO https://github.com/redpanda-data/redpanda/releases/latest/download/rpk-linux-amd64.zip &&
mkdir -p ~/.local/bin &&
unzip rpk-linux-amd64.zip -d ~/.local/bin/ &&
rm rpk-linux-amd64.zip
ENV PATH="~/.local/bin:$PATH"
COPY ./src /home
USER 1000
CMD ["benthos", "-c", "/home/main.yaml"]
I install benthos like this ,because the official tutorial say to do this.
Benthos instalation guide
I didn’t find other method to install this “language”
Docker-compose
services:
benthos:
image: benthos-study
build:
context: .
dockerfile: ./Dockerfile
ports:
- 8010:4195
volumes:
- ./src:/home/src/
container_name: benthos-container
stdin_open: true
tty: true
depends_on:
database:
condition: service_healthy
app:
build:
context: .
dockerfile: ./Dockerfile
volumes:
- ./src:/home/src/
container_name: python-container
depends_on:
database:
condition: service_healthy
database:
image: cassandra:latest
ports:
- 9042:9042
container_name: cassandra-container
healthcheck:
test: ["CMD-SHELL", "cqlsh -u cassandra -p cassandra -e 'DESCRIBE KEYSPACES'"]
interval: 30s
timeout: 10s
retries: 5
The cassandra-container start with no error , when it finish to build up the service , start the benthos one, but it give me immediatly an error
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "benthos": executable file not found in $PATH: unknown
And i don’t know how to resolve it , because it seems that he can’t find benthos, but i follow the exact thing that are writes on the officail guide.
Looking on internet, documentation and on stackoverflow . I didn’t find nothing that could help me to resolve this type of problem.
I expect someone can give me some advice to resolve it.