Giter VIP home page Giter VIP logo

Comments (23)

DanielJoyce avatar DanielJoyce commented on August 14, 2024 10

No need for that. Just need to configure the docker-compose volumes properly.

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on August 14, 2024 6

Python apps, especially those that cause pip commands to run, aren't ideal for dockerization. I'm working on a few things over the next week that should be able to support this, however even if I'm sucessful, it won't be the recommended way to install plugins and upgrade your octoprint installation when using docker.

The idiomatic way to do this would be to use the new images as a base in your own Dockerfiles, and then running a pip install for any plugins you want to install as a RUN pip install instruction in your own dockerfile, and then running a new docker build when new docker images are released.

Remember, docker is not an operating system, it's a process wrapper. It's not meant to do this, and if you do do this, then when you switch to new images of octoprint, things will likely break.

I'll be working on more documentation and configuration over the next week or so, and I also have a technique with PATH and virutalenv to test out that should let you do the things being asked of in this thread (even though again I'll stress that you do so at your own risk).

Some of the permissions issues should have already been fixed with the images deployed as a result of #19 2 days ago, and I'd appreciate any updates you can provide with your own testing of those images (which were pushed to the official ocotoprint/octoprint tag on docker hub).

We're now publishing both python 2 and python 3 versions of from both master and latest stable release (1.4.0 at the time of this comment). Multi-arch images will also be supported, and I'm planning on deploying those within the next 2 or 3 days.

Check them out on hub.docker.com/r/octoprint/octoprint

I also added a new CONTRIBUTING.md set of instructions and documents that may be of help if you want to build your own images for testing.

In the meantime, you can catch me on the #octoprint channel on freenode, or join my HackerHappyHour discord server and ask questions there. This discord invite link will take you directly to the raspberr-pi channel on that server: https://discord.gg/hGwvAPp.

from octoprint-docker.

stickystyle avatar stickystyle commented on August 14, 2024 2

I just came across this as well, the issue is that plugins that are installed via the plugin manager get put into the venv where Octoprint is running, namely /opt/octoprint/venv/lib/python2.7/site-packages/ and this dir isn't exported as a volume (I'm not sure you would want to).
I've only been playing with Octoprint for the last 8 hours, but I'm thinking perhaps passing -t /home/octoprint/.octoprint/plugins option to PIP from the plugin manager should get the plugins into the volume so they are not lost when the container is recreated.

from octoprint-docker.

TheFitzZZ avatar TheFitzZZ commented on August 14, 2024 1

@stickystyle could you please elaborate on the parameter passing you mentioned?

from octoprint-docker.

JoschaMiddendorf avatar JoschaMiddendorf commented on August 14, 2024 1

That’s exactly what I did as a workaround.

from octoprint-docker.

balert avatar balert commented on August 14, 2024 1

That’s exactly what I did as a workaround.

nice, I just thought I could comment this here, so others can save time, and might help.

from octoprint-docker.

johny-mnemonic avatar johny-mnemonic commented on August 14, 2024 1

Check this commit. This solution seems to work fine.

from octoprint-docker.

johny-mnemonic avatar johny-mnemonic commented on August 14, 2024 1

I would bet that the volume was the main issue, but seems to me, that your format of environment variables is not OK.
Here is my compose file for inspiration.
Do not use it 1:1, as it started as docker swarm stack file and I was lazy to clean it ;-)

from octoprint-docker.

TheFitzZZ avatar TheFitzZZ commented on August 14, 2024 1

Can confirm that the nunofgs/octoprint version works flawlessly for me and made me a happy octoprint user again :-) Thanks @johny-mnemonic for pointing it out!

from octoprint-docker.

gaetancollaud avatar gaetancollaud commented on August 14, 2024

Normally /home/octoprint/.octoprint should be enough. Do you use the docker-compose file ?

from octoprint-docker.

JoschaMiddendorf avatar JoschaMiddendorf commented on August 14, 2024

No as I’m using UnRaid OS docker compose isn’t supported. I’m using a GUI generated docker run command and with only .octoprint mounted all plugins are gone after any updates.

from octoprint-docker.

TheFitzZZ avatar TheFitzZZ commented on August 14, 2024

@DanielJoyce we already established that this is not the case.

from octoprint-docker.

balert avatar balert commented on August 14, 2024

I've had the same problem and found a really hacky solution for it. Seems to work for me.
The trick was similar to what @stickystyle proposed.

Well, -t /home/octoprint/.octoprint/plugins didn't work for me. Once I've figured out you can pass pip options in the octoprint settings under plugin manager I've tried this, and it didn't work because the plugin folder was empty and the installation of a plugin required the "OctoPrint" package as a dependency. Fiddled around a bit with this but it didn't work.

Then I thought I might just mount the site-package directory, as also proposed by @stickystyle but this didn't work either because it needed to be populated first, and coulnd't be empty.

So what I did so solve this was to mount a volume "venv" from outside to "/venv" inside the container and then get a bash inside the container (docker-compose exec octoprint bash) and copy the contents of /opt/octoprint/venv to /venv. Then I stopped the container and mounted the outside "venv" directory to /opt/octoprint/venv, by this octoprint resides outside the container and plugins are persistent and work.

However, clearly this isn't a good solution, I'm happy about any hints or tips to get this working.

from octoprint-docker.

JoschaMiddendorf avatar JoschaMiddendorf commented on August 14, 2024

Just to be exact. I just mounted /opt/octoprint/venv/lib/python2.7/site-packages/ not the whole /opt/octoprint/venv.

from octoprint-docker.

balert avatar balert commented on August 14, 2024

@JoschaMiddendorf in my case only site-packages didn't suffice. Don't recall the details.

from octoprint-docker.

ViolentCrumble avatar ViolentCrumble commented on August 14, 2024

I've had the same problem and found a really hacky solution for it. Seems to work for me.
The trick was similar to what @stickystyle proposed.

Well, -t /home/octoprint/.octoprint/plugins didn't work for me. Once I've figured out you can pass pip options in the octoprint settings under plugin manager I've tried this, and it didn't work because the plugin folder was empty and the installation of a plugin required the "OctoPrint" package as a dependency. Fiddled around a bit with this but it didn't work.

Then I thought I might just mount the site-package directory, as also proposed by @stickystyle but this didn't work either because it needed to be populated first, and coulnd't be empty.

So what I did so solve this was to mount a volume "venv" from outside to "/venv" inside the container and then get a bash inside the container (docker-compose exec octoprint bash) and copy the contents of /opt/octoprint/venv to /venv. Then I stopped the container and mounted the outside "venv" directory to /opt/octoprint/venv, by this octoprint resides outside the container and plugins are persistent and work.

However, clearly this isn't a good solution, I'm happy about any hints or tips to get this working.

could you provide any clearer instructions on the commands required to do this? having some trouble.

from octoprint-docker.

johny-mnemonic avatar johny-mnemonic commented on August 14, 2024

@ViolentCrumble I already posted working solution in the comment above.

from octoprint-docker.

ViolentCrumble avatar ViolentCrumble commented on August 14, 2024

@ViolentCrumble I already posted working solution in the comment above.

Hi, I tried that first and it did not work. I use docker-compose and i added in the line into my DockerFile but yeah couldn't work out how to make it work. It was just some environment variables right? Not sure why it didn't work but if you have any further info let me know.

Never mind tho as i ended up getting it to work the hacky way.

from octoprint-docker.

johny-mnemonic avatar johny-mnemonic commented on August 14, 2024

@ViolentCrumble
Never mind tho as i ended up getting it to work the hacky way.

Well, I always prefer nice and clean solution, if it's available ;-)

I am using that solution via docker-compose for few months already and I migrated my Octoprint container between three docker machines and two filesystems (providing the docker volume). So far it works flawlessly.
Those environment variables are nothing specific to Octoprint. Those are Python and Pip options, so they should work with any Octoprint install without an issue.
The question is, whether you are using persistent docker volume correctly. I would highly recommend using the container from that linked repo, to save the hacking time ;-)

from octoprint-docker.

ViolentCrumble avatar ViolentCrumble commented on August 14, 2024

sure if i can work out how to use it i will. I have my named volume working now.

I use docker-compose and i tried adding it to my docker-compose file but it did not seem to work, i tried adding it to my dockerfile and it didn't work.. I tried adding it like this in my docker-compose file and no luck.

environment:
    - DEBUG=1

but that might have been because back then my volume was not working correctly.

from octoprint-docker.

badsmoke avatar badsmoke commented on August 14, 2024

i need help with the implementation of this docker image.

PIP_USER true
PYTHONUSERBASE /home/octoprint/.octoprint/plugins

unfortunately do not bring the desired effect.

is there anyone here who knows about pip?

PIP_TARGET=/home/octoprint/.octoprint/plugins

is also not a perfect solution as he then packed all the other flask,websocket.... also shows in the pluginmanage

as a workarround I copy the original site-packages away before mounting the site-packages and copy them back before starting

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on August 14, 2024

closing in favor of #22

from octoprint-docker.

RyanBalfanz avatar RyanBalfanz commented on August 14, 2024

Here is another option: #22 (comment)

from octoprint-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.