Skip to content

Connector not found inside dockerized app #109

@therockf

Description

@therockf

Hello,
i am trying to dockerize memflow.
Initially i tried with normal memflow, now i am trying with memflow-py

This is my dockerfile:

FROM python:3.8-slim-bullseye

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        build-essential \
        curl \
        git \
        libbz2-dev \
        libncurses5-dev \
        libncursesw5-dev \
        libreadline-dev \
        libsqlite3-dev \
        libssl-dev \
        llvm \
        make \
        tk-dev \
        wget \
        xz-utils \
        zlib1g-dev \
        gcc \
        locales \
        python3-venv \
        python3-dev \
        procps \
        sudo
        
RUN echo 'vm.overcommit_memory=1' >> /etc/sysctl.conf

RUN sed -i '/it_IT.UTF-8/s/^# //g' /etc/locale.gen && \
    locale-gen
ENV LANG it_IT.UTF-8  
ENV LANGUAGE it_IT:it  
ENV LC_ALL it_IT.UTF-8

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

RUN cargo install memflowup --force

RUN /root/.cargo/bin/memflowup install memflow-qemu
RUN /root/.cargo/bin/memflowup install memflow-win32

COPY requirements.txt .

RUN pip3 install --no-cache --upgrade pip setuptools
RUN pip3 install wheel
RUN pip3 install -r requirements.txt

WORKDIR /app

COPY main.py .
COPY utils.py .
COPY offsets.py .
COPY config.py .
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh

CMD ["./entrypoint.sh"]

In both cases it looks like the code can't find the connectors. But they are installed correctly.

qemu-readmem-python           |   File "/app/./utils.py", line 50, in read_memory
qemu-readmem-python           |     connector = inventory.create_connector("qemu")
qemu-readmem-python           | Exception: connector: specified (connector) target could not be found

but the connectors are there:

qemuuser@2b9a84bb6e7b:/app$ ls $HOME/.local/lib/memflow/
libmemflow_qemu.stable.so  libmemflow_win32.stable.so

the user is correct:

qemuuser@2b9a84bb6e7b:/app$ ps -u qemuuser | grep uwsgi
      9 ?        00:00:02 uwsgi
     27 ?        00:00:00 uwsgi
     31 ?        00:00:00 uwsgi

This also happens using normal Rust memflow.

Inside a dockerized app, this results in connector not found.:


    let inventory = Inventory::scan();
    let connector = inventory
        .create_connector("qemu", None, connector_args.as_ref())
        .expect("unable to initialize qemu connector");

That doesn't happen if running outside docker! What is wrong there?

I have also tried manually adding the scan dir to the inventory buut nothing changes!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions