Docker Community Forums

Share and learn in the Docker community.

Run shell command after Run Container (devices dependency) => Starting OWFS

Hi All,
i build a image via Dockerfile.
The WebServer works fine. But now i want to add OWFS (DS9490) as an mountpoint. But this is only possible after statup of the container. So i am unable to run the necessary commands via Dockerfile.
I have a solution, but it requires a manual step.

What i did:

Dockerfile:
.-------------------------------------------------------------

  • FROM php:7.2-apache
    *…
  • RUN apt-get update && apt-get install -y \
  • nano \
  • python \
  • python-rpi.gpio\
  • owfs
  • ‘#’ owfs.conf and fuse.conf
  • COPY ./ows/ /etc/
  • ‘#’ OWS - Mount Points
  • RUN mkdir /mnt/1wire

  • .------------------------------------------------------------

Now i start the container an “bring” the USB Port into the container.

  • $ docker run -d -p 80:80 --privileged --device=/dev/bus/usb/001/003 --name test test

At this time OWFS is not started and not mounted to “mnt/1wire”. The WebServer runs.

After login to the bash of the container and run this command manually, it works fine to:

  • $ owfs -C -uall -m /mnt/1wire --allow_other

Now i searching for a solution to run this Shell Command after starting or restarting the container automatically
It is logical that I can only use the mount command after I have posted the devices.

Does somebody has any idea?

Thanks a lot
Don