Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Docker support. #1004

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added Docker support. #1004

wants to merge 2 commits into from

Conversation

utkudarilmaz
Copy link

Software has dockerized. Dockerfile added. README.md updated.

@kliment
Copy link
Owner

kliment commented May 25, 2019

I don't know what you mean by "Software has dockerized" but I don't see how this can work. Printrun needs access to local files (STL and gcode), it needs to store configuration (in .config), it needs access to hardware (sleep inhibition, scan for devices, connect to newly plugged device) and needs to be able to run external processes for slicing. You've given it access to some temporary files, and access to a single serial port. I don't see how it's going to be usable at all. I don't have objection to docker in principle, but the way it's implemented here breaks the core functionality of the application. It also introduces a potential malware vector as the readme is asking people to download a docker image from a third party location that is not guaranteed to come from the source code here. I'm not really happy with this situation, and I don't see how anyone gains anything from it.

@utkudarilmaz
Copy link
Author

Hello Kliment,

I don't know what you mean by "Software has dockerized" but I don't see how this can work.

I mean of "Software has dockerized", you can use software inside of a docker container.
So you don't need any installation process for use the software. You can build the image by running docker build -t printrun:latest . or you can pull the image from docker hub.
In my case, this is super comfortable. When someone wants to using the Printrun utilities they don't need create venv or installing packages. They will just run the container and Printrun utilities will be available.

Printrun needs access to local files (STL and gcode), it needs to store configuration (in .config)

You can mount any local file to container while starting the container with "-v" parameter.
For more information about that you can read the https://docs.docker.com/storage/volumes/

Also, if we need some files be permenant we can use the volume for storing the files on host computer permenantly. For this we just need add another line of Dockerfile but in my opinion we should't. Any person wants to store any configuration file permenantly he can mount the file to container while he started container.

it needs access to hardware (sleep inhibition, scan for devices, connect to newly plugged device)

Also, you can connect any host devices to container with "--device" paramater. I wrote this in README.md.

--device parameter for connecting the printer via specified device.

Unfortunately, i can't promise the all of functions will running without exception when you using Printrun on the Docker container. But we can improvement the Docker image with any trouble.

But i can't help for newly plugged devices mount to running container.

and needs to be able to run external processes for slicing.

What you mean in hear run external processes for slicing?
If you mean call subprocess or similar thing it's not a problem.
We can add to any missing software to image.

You've given it access to some temporary files, and access to a single serial port. I don't see how it's going to be usable at all.

I'm just wrote an example for my case. The "/dev/ttyUSB0" is my serial port to 3d printer's connected to my computer.

These temporary files is for using the Pronterface. If you run a process inside of container and the process has graphical interface like Pronterface you mount the .X11-unix socket to container so when a process starting in the container it's graphical interface start on the your host device.
In this case host is your computer.

It also introduces a potential malware vector as the readme is asking people to download a docker image from a third party location that is not guaranteed to come from the source code here. I'm not really happy with this situation, and I don't see how anyone gains anything from it.

If you want use the Printrun utilities inside of Docker you needs a container image.
In our scenario, you can build your own image follow the below command series.

git clone https://github.com/kliment/Printrun.git
cd Printrun

docker build -t printrun:latest .

docker run -ti --rm \
  --device /dev/ttyUSB0 \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  printrun:latest

On this option you pull the repo, and build container image with Dockerfile where inside of repository.
You can review the Dockerfile, i added this to pull request.

Your other option is if you have pre-builded image and you can run container from this image directly.
So without downloaded source code you can pull the printrun image from docker hub.
In this case you right. I had to specified where from you pulling image.

When you run docker pull <image_name> if you haven't login third party source, image will be pulling from https://hub.docker.com.

This is Docker's official hub. So in our case when you run docker pull utkudarilmaz/printrun:latest command in your terminal you pulling the image from Docker hub.
I recently created this image and it's connected the my git repository. You can review the Dockerfile in this repository.

Only difference between pull requesting Dockerfile and other Dockerfile, one of them you copying source codes from inside of repository, in other you pulling the source code by git clone command.

Of course we can connect the Docker hub to official Printrun repository. So any new commit on main repository automatically adapting to Docker image.

If you look Docker hub, another Printrun image was uploaded to hub and pulled more than 100 times. So i think people like me need to a Docker image of Printrun.

I hope I expressed myself clearly.
You can asking any other questions or something not clear is welcomed.

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants