June 9, 20251 yr Hi everyone,I've got a python app that can take a small variety of of launch parameters.Currently I've built a docker image that works in Unraid, that will run it with default parameters, and output stuff to the log.That's great, but what I'd love is to launch the image and just have it sit there.Then you go into the console for it, and actually run the python program from there, with whatever launch parameters you want that time.I'm sure this is a case of me not knowing much about docker/unraid yet and dabbling in things I don't fully understand.dockerfile:FROM python:3.11-alpine3.20WORKDIR /RUN apk update && apk add git (needed programs)RUN adduser -D (username) && mkdir /config /data /appRUN chown (username):(username)-R /config /data /appUSER (username)ENV HOME=/config \TZ=Etc/UTC \HOSTNAME=(image name)RUN pip install --upgrade pipCOPY /app/requirements.txt requirements.txtRUN pip install --no-cache-dir -r requirements.txtENTRYPOINT ["/bin/sh", "-c"]image run command:docker run -it --name='ImageName' --net='bridge' --pids-limit 2048 -e TZ="America/New_York" -e HOST_OS="Unraid" -e HOST_HOSTNAME="Unraid" -e HOST_CONTAINERNAME="ImageName" -l net.unraid.docker.managed=dockerman -v '/mnt/user/appdata/omb/':'/config/.omb':'rw' -v '/mnt/user/omb/monitored':'/monitored':'rw' -v '/mnt/user/omb/app':'/app':'rw' -v '/mnt/user/omb/init':'/init':'rw' omb -c "bin/sh /init/init.sh"init.sh:cd /apppython -u omb # the -u switch makes all print statements go to the log, which we can see in UnraidIs there a way to modify this to make it not actually fire off a script but just wait, so I can launch the Console for that docker and run it manually? Edited June 9, 20251 yr by theothermatt_b
June 10, 20251 yr Solution I am not sure you need to modify the image at all. I think you could just change the docker run command. Change the CMD portion of the docker run command to something like sleep infinityand change the -it flag to -d to run the container in detached mode. Edited June 10, 20251 yr by primeval_god
June 10, 20251 yr Author That didn't end up being the fix I used, but you pushed me in the right direction (a lot of times its just like, i don't even know what to search for).I ended up changing -it to -d -t and removing anything after the image name at all.Also I removed the ENTRYPOINT line entirely from the dockerfileThank you!! (Assuming none of the above was a stupid thing to do for any reason...)The only trick left is if I could have the console default to the /app directory instead of /
June 10, 20251 yr Add another WORKDIR line at the end of the dockerfile. Or use the --workdir option in your run command Edited June 10, 20251 yr by primeval_god
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.