Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
63 views
in Technique[技术] by (71.8m points)

How do I make a docker image of my pi’s setups?

I’m trying to share my setups on Raspberry pi4 for my teammates So that they can all use the same setups I have now.

So far, On My Raspberry pi , I have downloaded tensorflow, stuffs for Object detections and also set up a Web server with APM. I heard that I can share all these setups on this pi using docker by making an docker image But I don’t know how .

I’ve tried to pull images of Tensorflow and APM from Docker hub and run them all in one container then share it after making it as an image.

but then I realized that I wouldn’t be able to share the files I have for OD.

Can anyone please explain me how to make an Docker image of the entire setups on my pi?

question from:https://stackoverflow.com/questions/65905757/how-do-i-make-a-docker-image-of-my-pi-s-setups

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to share you're whole raspberry-pi setup, then you have to share a image of your SD-card.

A image contains the whole filesystem and has normally a size of a few gigabytes. It's not recommended to share them to teammates for each little change.
There are different ways to create a image - just google for "create image sd card".

A docker-image is like a image, but is has much less data. Docker-Images does not contain the whole operation-system.
If you want to share your docker-image, then your teammates have to setup their Pi's first.
And you need a repository where you can upload your images (and your mates can download). A good plattform is https://hub.docker.com

It sounds for me, that you want to share code. For code-sharing I recommend git. There are some good tutorials for https://github.com

My hint: Setup a pi with all the things you need (tenserflow, git, ...). You can share this image with your mates. The code of the project can you store on GitHub. When you update the code, then your mates can get these updates with git pull - these changes are normally very small and not some gigabytes for the whole image.

If you train big complex models and want to share them, than a docker-image is the best choice.
In this case share a image for raspberry with docker. Docker-Images are split in different layers. With a good design, these layers are small and good for sharing.


Your questions in your comment:

You can install tenserflow in a docker-image. There are good instructions on their site. https://www.tensorflow.org/install/docker

I would recommend a Dockerfile like this:

FROM tensorflow/tensorflow  # latest stable release

ADD requirements.txt requirements.txt # https://pip.pypa.io/en/stable/user_guide/#requirements-files
RUN pip install -r requirements.txt && rm -f requirements.txt

ADD src/* /app/
WORKDIR /app

ENTRYPOINT["python"]
CMD["-u", "yourscript.py"]

Every time when you change your code, then you can build it with docker build . -t <IMAGE-NAME>.
You have to push the image somewhere (like hub.docker.com). docker push <IMAGE-NAME>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...