Notifications
Clear all

Are there any Docker experts here?

27 Posts
4 Users
5 Likes
439 Views
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

I want to use Docker on a couple of my Raspberry Pi4B-4MB boards running Raspberry Pi OS. I know there will be millions of hits on Google, but I want somebody who knows the software to point me in the direction of least resistance. I just want to use the concept, I have no need or desire to 'know' all the ins and outs. I 'played' with it before after being told it was simple but quickly found they lied. There was config files, install stuff, quite a lot more than the high level description of Docker says.

 

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
Quote
YurkshireLad
(@yurkshirelad)
Honorable Member
Joined: 2 years ago
Posts: 471
 

If you say what you want to do, perhaps I can make a few suggestions. I haven't used docker in a while, nor am I an expert.


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

@yurkshirelad I want to learn how to use docker to run a few apps. I understand it is somehow better to use Docker as opposed to just starting a bunch of apps as we did in the past.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
DaveE
(@davee)
Prominent Member
Joined: 2 years ago
Posts: 788
 

Hi Ron @zander,

 Docker is still on my to do list of things to look at, so I haven't even got to novice level,  but @frogandtoad very kindly and helpfully discussed Docker and other virtual machine options under the "Dual Boot Workstation - Windows 11 & Ubuntu 22.04" thread

His advice regarding Docker, was to look at the LearnLinuxTV Youtubes ...

which I just Goggled includes https: //www.youtube.com/watch?v=WpwtzQq5Er4

Prompted by F&T, I have watched a few useful videos by the same person, but not these ... yet!

Best wishes, Dave


   
frogandtoad reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

@davee I can't remember now why I was interested other than a general need to run multiple applications. My questionable memory is that back in the days before VM's, DropBox etc we just ran multiple apps. Perhaps a sample list of apps will lend some clarity.

Web server, Mail, MQTT, VPN, backup like Mac Time Machine, NAS, Plex, Air Quality like Bill's, home made weather station.

Isn't running things like web servers, mail, vpn, pi-hole normally just run as multi processing?

But something like Plex and/or NAS are ???.

Keep in mind this is all to be run on a RaspberryPi4B with 4GB memory until it's possible to buy a new Pi with 8GB or possibly a future Pi5.

I still do NOT know if I need anything like Docker to run a home server. 

Let me put it another way. I do NOT want to hear a lot of $100 words designed to impress management. If performance is an issue, I only care about real world as seen at my screen and keyboard performance issues. The fact that a web server is 10msec quicker to send an response is totally unimportant to me as a user while in a corporate setting it may be life and death.

I hope I am making myself clear.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
DaveE
(@davee)
Prominent Member
Joined: 2 years ago
Posts: 788
 

Hi Ron @zander,

   As I said,  for Docker, I haven't even made novice level yet. However, my impression (probably flawed) is that aims to get around some of the issues often faced on a server running several different applications when installing, and maintaining as bug fixes and upgrades, etc. come out,  such as libraries missing or mismatching, etc. So it provides a way of loading a 'ready to run' image, that has a degree of isolation from all of the other applications. In principle, this should make installing or updating an application plug n play. I am completely unclear how much preparative work is required to get to that stage.

The extent to which it achieves those aims, and any other aims, I have to leave to your imagination and research. Clearly, it has attracted considerable attention, though to what extent that relies on heavy horsepower server resources, I am unclear.

Personally, i would be surprised if it made a dramatic improvement to a sensibly installed PI4 or PI5 system, but that is pure conjecture on my part. Perhaps it would be easier and quicker to setup, once you have got through the learning curve?

Anyway, if you are interested in seeing what it offers, maybe a quiet hour or so watching the YouTube's would be educational, even if you decide it's not for you. Just an honest suggestion.

Best wishes and take care my friend, whatever you decide. Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

@davee Sorry, most of your points make no sense to me. The one thing I did manage to pick up is that compared to VM's (but is that even needed?) containers all run on the same OS and are therefore less complex. You are correct that someone else can create a ready to run container and that may be simpler to install than the usual but when I tried it I still had problems. See the attached for the docker system in a nutshell. My confusion is due to the fact I was never considering VM's of any kind, can't I simply run a web server AND a mail server AND a NAS and a PiHOLE and Bill's air quality and a weather station and backup and a few more WITHOUT either VM's or docker? I am 99.999% sure the answer is YES I can, so why on earth would I entertain a VM? I thought the Docker solution provided some benefit, I don't see it but I need to understand it more to ensure I am not passing up an opportunity.

Screenshot 2022 11 27 at 14.40.03

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
YurkshireLad
(@yurkshirelad)
Honorable Member
Joined: 2 years ago
Posts: 471
 

I haven't had time to reply but docker containers do have advantages. Starting a container for a web server, for example, doesn't install anything into your local filesystem. Well except the container image, but I mean it doesn't modify /etc or any other system folder.

So you start a container for a web server, stop the container and your filesystem is as it was. Want to run a different version of the webserver? Simple, tell docker to use a different version, it downloads the container image for the new version, and runs it.

Containers aren't always easy, but they can really simplify life. For example, if you just want to fire up a MySQL instance to poke around and experiment, create a Dockerfile (plenty examples online) and start the container. When you're done, stop the container, nothing to clean up.

I know I'm not really helping but I'm typing this on a tablet when I should really use the laptop to post some sample Dockerfiles and other useful info. I'm simplifying using containers but that's ok at this point.


   
ReplyQuote
DaveE
(@davee)
Prominent Member
Joined: 2 years ago
Posts: 788
 

Hi Ron @zander,

 As far as I know, (which isn't much as I already mentioned), then I don't think Docker will enable you to run programs appreciably faster, etc. than you can do without it.

I think Docker aims to minimise the manual workload in maintaining server systems. However, the commercial interest will apply to organisations running a huge number of servers, and possibly have a large number of servers running the same applications. Thus, the overhead in setting up a new configuration may be amortised over a large number of (possibly identical) machines.

This is clearly a different situation from an individual with just 1 server. Sorry I don't have enough experience to know how useful it will be, but I suspect there are other things that might be more interesting.

Best wishes, Dave


   
ReplyQuote
YurkshireLad
(@yurkshirelad)
Honorable Member
Joined: 2 years ago
Posts: 471
 

Here's the simplest example for running MySQL. Run this command:

docker run --name mysql -d \
    -p 3306:3306 \
    -e MYSQL_ROOT_PASSWORD=change-me \
    --restart unless-stopped \
    mysql:8

The parameters:

  • --name  is the container's name
  • -d         means run in the daemon mode, run the container instance in the background and return control of the command prompt to you
  • -p         map port 3306 in the container to port 3306 on the local machine, basically expose the port so anything outside of the container can access it
  • -e         environment variable, in this case the default root password for MySQL
  • --restart   when to automatically restart the container, e.g. if MySQL crashes
  • mysql:8   The name and version of the docker image to use (docker images can be found on https://hub.docker.com)

I did a random Google search and found the above example from https://earthly.dev/blog/docker-mysql/.

How do you know the container is running?

docker ps

How do you stop the container using its name?

docker stop mysql

How do you access MySQL? Run any MySQL client and connect to localhost at port 3306. Docker will automatically proxy your connection to port 3306 inside the container, as we exposed the port.

How do you use a different version of MySQL?

docker run --name mysql -d \
    -p 3306:3306 \
    -e MYSQL_ROOT_PASSWORD=change-me \
    --restart unless-stopped \
    mysql:8.0.31

In Docker vocabulary, the version number is a "tag". Tags are searchable on the Docker Hub, e.g.: https://hub.docker.com/_/mysql/tags?page=1&name=8, but don't click on a tag until you understand things so far, otherwise you'll just get confused. 😀 

Why would you use a docker container instead of a VM? When you use a VM, you have to install and configure the operating system, then install updates and whatever packages you need, e.g. MySQL. The VM will likely need 4+Gb of memory and maybe 20Gb of disk space.

A docker container is a thin layer of software on top of an OS, so its memory and disk footprints are a fraction of a VM's. It only needs the amount of memory used by MySQL (perhaps plus a small bit of overhead memory), and whatever disk space the MySQL binary and libraries need, plus the database storage. Much, much less than the 20Gb for a VM. If that makes sense.

I'm typing all this from memory so I may have made mistakes here and there. I hope this helps and doesn't confuse you more.

Oh one more nugget of information. Let's say, for some bizarre reason, that you needed to run two python applications, one written for Python 2.X and one written for Python 3.x. You could run the Python 2.x app in one container, and the Python 3.x in another container. They don't share Python files and are self-contained. You don't have to install Python 2.x or 3.x locally to run either.

Containers are flexible and no, they're not simple once you go beyond the basics. Despite what anyone tells you. The concepts used can be confusing, but I think, once you get your head around them, they do make sense. I used to work with someone who was as anti-container as you can get. He would get incredibly worked up and angry at the thought of having to use them. Until he understood the concepts and then started using them on a daily basis.

I'm not sure if 4Gb would be enough to run everything on your list:

Web server, Mail, MQTT, VPN, backup like Mac Time Machine, NAS, Plex, Air Quality like Bill's, home made weather station.

I'm no expert, perhaps someone else can chime in. I only have an 8Gb Pi.

This post was modified 2 months ago by YurkshireLad

   
DaveE reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

@davee Don't need faster. I think my investigation is over. I can't imagine what benefit there is in adding another layer of complexity. Setting up either servers like mail, web, piHole, PLEX, etc and adding a cron job for backup are all second nature to me and besides, you still need to do that anyway and then do whatever docker needs to turn it all into a container. I doubt there is any benefit for a one person one keyboard, one screen system. Maybe someone who has similar needs and experience can tell me why I am mistaken, I will be on pins and needles awaiting that reply 😉

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
YurkshireLad
(@yurkshirelad)
Honorable Member
Joined: 2 years ago
Posts: 471
 

I'm not going to try to change your mind. If local installations work for you, carry on.


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

@yurkshirelad Excellent info. Somewhere along the line this topic got a little off track. I never said I was going to run a VM. I can see there is a big resource difference between a VM and a container. I was trying to gain insight about docker containers as opposed to normal multi-process/server operation. I am not easily swayed by the marketing talk, I have still not seen anything that convinces me I am somehow ahead by using containers. From what I have seen, I still have to 'configure' the server, then configure the docker container. Adding even a thin layer is ADDING. Telling me it's cool or all the kids are doing it carries no weight with me. Somewhere in the corner of my mind I think I read that docker was a good solution for deploying applications. That does not apply to me.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
YurkshireLad
(@yurkshirelad)
Honorable Member
Joined: 2 years ago
Posts: 471
 

Fair enough, you have clearly made up your mind. I have nothing to add. 👍 


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3915
Topic starter  

@yurkshirelad The idea of downloading a container is not appealing to me for a few reasons. Using Strawberry Pi OS and doing an "apt install" gets me the widget. I am not experimenting with different flavours or versions of a web server, it's a tool I need and want it to just run in the background and do what it does.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
Page 1 / 2