3 ms·
Could you provide more info on your setup for this? I work on some EL 6 servers and would be interested in using this setup.
by memco 9y ago
Could you provide more info on your setup for this? I work on some EL 6 servers and would be interested in using this setup.
- Leynos 9y agoNot the OP, but replying to offer a suggestion in this respect. I'll often do something similar to this, where I have a CLI tool that I'm not ready to deploy server-wide yet, and has hefty dependencies. The pattern I use is to have a wrapper shell script that calls: docker run -it --rm --volume "$(pwd)/$1:/file_to_process:z" --user $(id -u) container-image /opt/command_to_run /fileToProcess This runs "/opt/command_to_run /fileToProcess" inside a container as the current uid, mounting the parameter to the shell script as "/file_to_process" inside the container. The :z mount parameter may or may not be needed depending upon whether you have SELinux enabled or not (by default, SELinux prevents countainers accessing any file on the host, and :z changes the SE context to allow access). I don't know if this is the case with EL6 tho. The -t parameter shouldn't be used if your script is running in a pipeline (it creates a pseudo-tty). So it may be worth having some kind of conditional to remove this. The wrapper I use also has a conditional to add the "$(pwd)" prefix to the call parameter only if the parameter is a relative path.
- aepiepaey 9y agoIf Python 3.4 is good enough, you can get it from the EPEL repos.
- amyjess 9y agoHonestly, I just wrote my Dockerfile using the example from the official Python container: https://hub.docker.com/_/python/ https://hub.docker.com/_/python/ Then I push the image to my company's internal Docker registry, ssh into the server, and pull the image. (also, aside from using Python 3 on RHEL 6, it also means using Python 3.6 on RHEL 7 without having to install python36u) Edit: Dockerfile (script name redacted) FROM python:3 WORKDIR /usr/src/app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt COPY . . CMD [ "python", "./redacted.py" ] Build and push commands (company and script names redacted): docker build --rm -t dreg.example.com/redactedproject/redacted . docker push dreg.example.com/redactedproject/redacted Pull and run on the server (same stuff redacted as above, plus I redacted the actual port number to be on the safe side): docker pull dreg.example.com/redactedproject/redacted docker run -p 1337:1337 -d --name redacted dreg.example.com/redactedproject/redacted And at some point, I'll make proper startup scripts for them. On RHEL 7 boxes, I've made systemd unit files. On RHEL 6... well, I suppose I'll be writing initscripts soon.