[Help] Custom docker images #1877
-
|
Hi everyone, I'd first like to say I'm sorry to create a topic to ask for help with this. I know this isn't the purpose here, but when I asked for help on Telegram, besides being ignored, I was treated very badly. Anyway, I'd like to know how I can create a custom image with pre-installed packages. I have a "containerfile" that I've been using for months, but the image doesn't work with DistroBox. 90% of the packages I installed disappear, and the configurations I made also disappear. I can't create an image that's ready to use in any way. I know there's an overlay and several directories are mounted on top. I've tried various things, I just wanted to know if there's a solution for this, and if so, what it is. I really liked the project; with the little time I have, it fulfills a very important need in my workflow. container file: assemble file: install.sh init.sh |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 4 replies
-
|
The containerfile is missing the FROM statement and you didn't paste the content of init.sh and install.sh, so it's very difficult to understand what you're trying to do here. Could you expand a little bit? |
Beta Was this translation helpful? Give feedback.
-
|
@dottorblaster Ty for help, I edit the original message with these infos. I'm starting now making my workflow, I know this can show confuse, but is a test to try to create a custom image, to have a custom image is awesome to my workflow |
Beta Was this translation helpful? Give feedback.
-
|
You can have a custom image but for the purpose you are trying to achieve I think a manifest file would be sufficient. [kali]
image=docker.io/kalilinux/kali-rolling:latest
pull=true
nvidia=false
root=true
replace=false
init_hooks=""
pre_init_hooks="export SHELL=/usr/bin/zsh;"
skip_workdir=1
additional_packages="nmap wireshark net-tools"
additional_packages="lsd zsh aircrack-ng"
# more additional_packages line here with the packages you actually need
container_init_hook="path-to-init.sh"Try |
Beta Was this translation helpful? Give feedback.
-
|
I understand, I'm using it like this at the moment; however, this isn't the final file. I was just trying to create a custom image. For my purposes, having a custom image would be excellent, but I haven't been able to achieve that result yet. |
Beta Was this translation helpful? Give feedback.
-
|
I don't understand why you can't do whatever you're trying to to with an assemble file instead of a custom image. Anyway, I would need logs to inspect the behavior of the custom image and most importantly you would have to provide the complete files and the complete workflow you're trying to achieve, something that at the moment seems very secret. |
Beta Was this translation helpful? Give feedback.
-
|
Actually, I was just trying to run an image I have from work. It installed some tools we have here, and some, like in the Dockerfile above, also have internal company network configurations. I've already extracted a file that connects, etc. That's why I didn't share it. I was trying to create a custom image to understand how it worked, but unfortunately I couldn't. I looked for a guide, but I didn't find anyone who had created their own Dockerfile. If you have one I could use as inspiration and try to make it work, that would be great. But I won't waste any more of your time pushing the idea of creating a custom image, as I believe it won't be very promising since I can't provide much information about the image. If there's no further contact, thank you for your support. Feel free to close this issue. |
Beta Was this translation helpful? Give feedback.
-
|
@n1ckisthereu I just wanted to know what was going on under the hood 😅 because usually custom images are sort of a last resort, especially when you don't have the containerfile. Most probably distrobox will not work with just a random container coming from the internet, because usually container images tend to drop most of the userland to lower the attack surface (for example, see distroless containers). I didn't want to simply close this as maybe someone has a good answer out of the blue to the topic, so I just moved it to discussions. It is absolutely possible to have a custom image, but from the things you wrote it looks like that container image in particular has a lot of things baked in that will get in your way of making it work well. I would tell you to create a multi stage build with FROM the_cursed_image AS layer1
COPY some/network/configuration
COPY some/strange/executable
FROM docker.io/kalilinux/kali-rolling:latest
COPY --from=layer1 all/the/stuff/you/needThis should work. If you want to look into something more complex there's also Jorge Castro's boxkit. |
Beta Was this translation helpful? Give feedback.
-
|
Good morning, everyone. I’m pleased to report that this wasn’t a bug — it was simply my oversight. Over the weekend, I decided to document the steps to reproduce the issue. I created a custom Ubuntu image and tried to access it as root. That’s when I noticed that the image wasn’t being found when using the --root flag. Then I remembered that when I created my first custom image, I had the same “problem”: I ran podman build as root, and afterward ran another podman build without root. In other words, the image I was testing didn’t contain the installed packages or the files I had copied. After running sudo podman images, I realized that the only image available was from two weeks ago. |
Beta Was this translation helpful? Give feedback.

Good morning, everyone. I’m pleased to report that this wasn’t a bug — it was simply my oversight.
Over the weekend, I decided to document the steps to reproduce the issue. I created a custom Ubuntu image and tried to access it as root. That’s when I noticed that the image wasn’t being found when using the --root flag. Then I remembered that when I created my first custom image, I had the same “problem”: I ran podman build as root, and afterward ran another podman build without root.
In other words, the image I was testing didn’t contain the installed packages or the files I had copied. After running sudo podman images, I realized that the only image available was from two weeks ago.