I am a new bee…in the Docker world…actually, I’m facing some problem to get the host device information. Before, I’ll ask my question…I’d like to explain a bit of my working scenario and code…so that might help you to understand my problem.
I want to know the various resource components (i.e., RAM, CPU, Storage, Power, OS, Network etc.) information of a device and also the location of the device. So, I write down some simple python program using the following python package -
So, whenever, I used to run my code on the host machine…it is perfectly working and providing me with the desired output, but after that, I tried to containerizing my code and created the docker image. Then the problem is raised …now it is providing the information of resource components of the container. But I want to get host device resource information rather than getting the container’s resources components information.
I’m sharing my Dockerfile code in the below:
RUN mkdir /var/app
ADD venv/ venv/
ADD device_info.py/ .
RUN bash -c 'source venv/Scripts/activate’
RUN bash -c 'pip3 install geocoder’
RUN bash -c 'pip3 install py-cpuinfo’
RUN bash -c 'pip3 install psutil’
CMD [ “python”, “./device_info.py” ]
So, will anyone please help me what should I do…and what are the things should be added in the Dockerfile to get the host device information… Thanking all of you in advance.