this post was submitted on 30 May 2024
3 points (80.0% liked)

Docker

39 readers
1 users here now

Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.

founded 1 year ago
MODERATORS
 

There's a service that I want to use, however for reasons, it no longer has any builds available. Consequently, I am thinking of building it myself. How does one go about doing that and then afterwards, how do I get it up on Docker hub? Can I just create an account and upload?

top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 6 months ago (2 children)

First, you'll need to pick a base image. There are lots to choose from and what you choose will entirely depend on what this service is. NodeJS, python, php, java, etc, all have really solid base images that I would recommend working from. If none of those frameworks apply then you'll need to work from an OS base image like debian or alpine. I highly recommend debian:stable-slim if you go this route.

My recommendation is to then spin up a container of your base image and do the install of your service manually, taking careful notes of all your steps. If anything breaks, just blow it up and start again. Once you have all your steps you'll need to convert that list into a Dockerfile. Go step by step and learn how to do each thing from the docs. Then you can build the image from the Dockerfile and upload to docker hub or anywhere else.

[–] [email protected] 1 points 6 months ago
[–] [email protected] 1 points 6 months ago (1 children)

Really sorry to bother you again. Mind if I ask a couple basic questions?

[–] [email protected] 2 points 6 months ago (1 children)
[–] [email protected] 1 points 6 months ago (1 children)

Thank you so much. Okay. I'm trying to update an image that's been depreciated. I figure all I have to do is update the Docker file and the rest should be simple.

I want to do it on my Pi, but I don't want to pollute my Pi with superfluous stuff. Is that a pipe dream? Everything seems to say yes, but I just need confirmation.

If yes, I guess I need to create a new directory. If I create a new directory and then create the Docker file there, will it affect my image? Like do I need to match the directory name and image name?

Sorry, these are super basic questions, but I always get super anxious before trying things. What I love about Docker is that I can always delete and start again and the fact that this doesn't follow that is making me extra cautious.

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago) (1 children)

You can absolutely do this without polluting anything on your system.

The directory name doesn't matter, when you build the image you'll specify a tag for it.

The only thing to watch for is when you build the same tag name again, as you iterate on the Dockerfile changes, docker won't remove the old image from your local registry. It will just untag it, so you might see several images called something like "". Remember to remove those every so often so you don't fill up your Pi's storage.

Edit: Also Docker will keep a "build cache" for this stuff, which doesn't really "pollute" anything but it does take up disk space. You can clean that up with docker builder prune, read this for all the usage info: https://docs.docker.com/reference/cli/docker/builder/prune/

[–] [email protected] 2 points 6 months ago

I cannot thank you enough. Thank you so much!

[–] [email protected] 2 points 6 months ago

Yes, you can make an account and upload an image. As for making the image, download a base image and use a docker run file to build the image.