Community discussions

MikroTik App
用户头像
sunakashi
刚刚加入了
Topic Author
Posts: 17
加入: Wed Nov 23, 2022 1:55 pm
Location:CZ

How upgrade container?

Mon Dec 12, 2022 3:57 pm

请,how can I upgrade container, more specific pihole. I'm used to SSH, but I have no idea how to do it in RouterOS and I cannot find anything relevant to this topic. Thanks.
Top
用户头像
Shahid
newbie
Posts: 25
加入: Sat Nov 05, 2016 3:31 am
Location:Multan, Pakistan
Contact:

Re: How upgrade container?

Mon Dec 12, 2022 10:08 pm

请,how can I upgrade container, more specific pihole. I'm used to SSH, but I have no idea how to do it in RouterOS and I cannot find anything relevant to this topic. Thanks.
If it allows then backup your pihole settings, remove container & pull again then restore settings.
Top
用户头像
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 938
加入: Thu Jul 14, 2016 9:29 pm
Location:Belgium

Re: How upgrade container?

Mon Dec 12, 2022 11:04 pm

If you made folder-mappings / mounts on the Pihole container pointing to some USB-storage for eg. /etc/pihole I would thing there is no need to export/restore the config as it is not deleted when you delete the Pihole-container ?

1) Stop the container
2) Delete the container
3) Pull newest instance with exactly the same settings (eg. mounts, vETH interface etc,etc)
4) Start container

Or is my logic flawed ? I do the same for a bunch of containers running on my Synology NAS. Every container should be stateless and all important data should be kept outside of it...
Top
tangent
Forum Guru
Forum Guru
Posts: 1066
加入: Thu Jul 01, 2021 3:15 pm
Contact:

Re: How upgrade container?

Tue Dec 13, 2022 3:35 am

Or is my logic flawed ?

Nope; it's precisely correct, often phrased as the "cattle vs pets" analogy. If you can't "slaughter" your cattle and bring new ones into their place without major disruption, you're doing something wrong.
Top
用户头像
Amm0
Forum Guru
Forum Guru
Posts: 2515
加入: Sun May 01, 2016 7:12 pm
Location:California

Re: How upgrade container?

Tue Dec 13, 2022 6:07 am

often phrased as the "cattle vs pets" analogy. If you can't "slaughter" your cattle and bring new ones into their place without major disruption, you're doing something wrong.
Now that funny and 100% spot on.

And the say "curiosity killed the cat" too: so I wouldn't recommend trying "/container/reset 0 file=mycontainer.tar" to reload an image – as that borked a working image for me nor replace it. Had to slaughter that cow and/or bury the dead cat. Likely that cow is easily reincarnated using same file, envlist, mounts, & just like new.
Top
用户头像
sunakashi
刚刚加入了
Topic Author
Posts: 17
加入: Wed Nov 23, 2022 1:55 pm
Location:CZ

Re: How upgrade container?

Wed Dec 14, 2022 3:47 pm

请,how can I upgrade container, more specific pihole. I'm used to SSH, but I have no idea how to do it in RouterOS and I cannot find anything relevant to this topic. Thanks.
If it allows then backup your pihole settings, remove container & pull again then restore settings.
Well... That is not very user friendly. I'll probably stick with RPi and SSH.
Top
tangent
Forum Guru
Forum Guru
Posts: 1066
加入: Thu Jul 01, 2021 3:15 pm
Contact:

Re: How upgrade container?

Wed Dec 14, 2022 4:11 pm

I'll probably stick with RPi and SSH.

Containers are not VMs. Get your head around that, and you'll start to see why containerization is taking over the world.
Top
用户头像
Amm0
Forum Guru
Forum Guru
Posts: 2515
加入: Sun May 01, 2016 7:12 pm
Location:California

Re: How upgrade container?

Wed Dec 14, 2022 4:12 pm

Well... That is not very user friendly. I'll probably stick with RPi and SSH.
I think the point is generally with containers if you ever need to use SSH to change them, you may be doing something wrong. *unless your trying to develop/test a new Dockerfile or modify something that is a "mounted"... The key thing to understand is data/config and code are designed to be seperate, so it should be completely safe to just the replace the code part, while leaving the data/config part stays same.

在你的情况下,您应该能够删除existing container in /container, then just add another, picking the new PiHole image, use same envlist , same mounts, - it will pull a new one and use your same setting as before – since there stored separately e.g. mount and environment tabs. Mikrotik docs direct folk to setup PiHole up this way already with the config/data being seperate from image, so you should be set there. So it's really just "delete the container to upgrade" that needs to be added, then follow the same step for just creating the container you used originally (since you'd already created the envlist and mount the first time).
Code:Select all
# find your pihole container's ID (generally 0) that you want to upgrade /container/print # remove container /container/remove 0 # re-add same container /container/add file=pihole.tar interface=veth1 envlist=pihole_envs mounts=dnsmasq_pihole,etc_pihole hostname=PiHole
But there isn't a "one button" (or command) way to pull a new image AFAIK. And if you did SSH into the box, and changed stuff outside the configured mounts, then YES those changes be lost. If you used mount and/or envlist, those are preserved even if the container gets delete. Thus the advice to always use environment variables to configure containers (or build your image on a PC using a customized Dockerfile as works). To @tagent's point, Mikrotiks are generally "pets" while containers should be the "cows".

If you like running PiHole on a seperate box, I can't argue that may be simplier. But the docker model may be worth thinking about, even how to upgrade isn't obvious at first.
Top
tangent
Forum Guru
Forum Guru
Posts: 1066
加入: Thu Jul 01, 2021 3:15 pm
Contact:

Re: How upgrade container?

Wed Dec 14, 2022 4:24 pm

Mikrotiks are generally "pets"

It isn't necessarily so. Larger organizations will have an automated deployment process that takes a stock RouterOS box, upgrades it to some tested firmware release, maybe sets a skin, applies a configuration, tests it all, and shuts it down, ready for deployment.

Sound like containerization? It should, because it's part of the same movement, variously styledDevOpsorInfrasructure as code. Hardware isn't as malleable as software, but at scale, you can bet all those CPEs and WISP tower radios aren't being treated as pets.
Top
用户头像
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 938
加入: Thu Jul 14, 2016 9:29 pm
Location:Belgium

Re: How upgrade container?

Wed Dec 14, 2022 4:24 pm

Updated my Pi-hole yesterday on the RB5009 and 30seconds later it was already back up & running with all config (because stored outside the container-image)
Can't be more simpel then this...
Top
用户头像
Amm0
Forum Guru
Forum Guru
Posts: 2515
加入: Sun May 01, 2016 7:12 pm
Location:California

Re: How upgrade container?

Wed Dec 14, 2022 4:46 pm

Mikrotiks are generally "pets"
It isn't necessarily so
I 100% agree. More thinking the OP was trying to "upgrade PiHole", which does take a little container philosophy to understand. But II think the metaphor was getting lost - but not wrong.
Top
tangent
Forum Guru
Forum Guru
Posts: 1066
加入: Thu Jul 01, 2021 3:15 pm
Contact:

Re: How upgrade container?

Wed Dec 14, 2022 5:12 pm

Incidentally, this thread inspired me to come up witha better analogy.
Top
用户头像
Amm0
Forum Guru
Forum Guru
Posts: 2515
加入: Sun May 01, 2016 7:12 pm
Location:California

Re: How upgrade container?

Wed Dec 14, 2022 6:06 pm

Incidentally, this thread inspired me to come up witha better analogy.
Not mix metaphors. But the "reincarnate" method is what's missing.

@jvanhambelgium points out isn't hard, just 4 steps. RouterOS ideally have some option that keeps setting, and reloads the image file (or pulls from registry) since that's what the OP was after, I think.
Top
用户头像
sunakashi
刚刚加入了
Topic Author
Posts: 17
加入: Wed Nov 23, 2022 1:55 pm
Location:CZ

Re: How upgrade container?

Sat Dec 17, 2022 1:34 pm

I think the point is generally with containers if you ever need to use SSH to change them, you may be doing something wrong.
I would prefer to update simple by pressing a button in GUI, that's why more people prefer Adguard over pihole.

But with containers here it is a next step to learn. NextDNS alone makes sense even more.
Top
Z0ltan
newbie
Posts: 33
加入: Sat Dec 15, 2018 3:07 pm

Re: How upgrade container?

Sun Feb 19, 2023 12:08 pm

I have scripted it however the container status is always “error” after running the script. Issuing the same commands works.

/container/stop 0
:delay 20s;
/container/remove 0
/container/add remote-image=pihole/pihole:latest interface=veth1 root-dir=disk1/pihole mounts=dnsmasq_pihole,etc_pihole envlist=pihole_envs hostname=pihole start-on-boot=yes
:delay 60s;
/container/start 0
Top
PeterXC
Frequent Visitor
Frequent Visitor
Posts: 67
加入: Fri Feb 10, 2023 7:51 pm

Re: How upgrade container?

Fri Feb 24, 2023 11:24 pm

I have scripted it however the container status is always “error” after running the script. Issuing the same commands works.

/container/stop 0
:delay 20s;
/container/remove 0
/container/add remote-image=pihole/pihole:latest interface=veth1 root-dir=disk1/pihole mounts=dnsmasq_pihole,etc_pihole envlist=pihole_envs hostname=pihole start-on-boot=yes
:delay 60s;
/container/start 0
I'd add logging=yes

In my case, 60s can be too short. Sometimes it extracts longer.

Keep in mind that starting 7.7 USB mount is not disk1 but usb1-part1
Top

Who is online

Users browsing this forum: No registered users and 1 guest