LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 03-13-2024, 01:11 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post A few questions about Docker configuration


Hello,
I have some questions about the Docker configuration:
1- I want to start an Nginx container using Docker Compose, what is the problem with the following configuration?
Code:
version: '3'
services:
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./src:/usr/share/nginx/html
links:
- php
php:
image: php:7-fpm
2-How do I update the components of a container? For example, the configuration file above uses PHP version 7, which is outdated.

3- Should the firewall be configured in the container or on the host?

Thank you.
 
Old 03-13-2024, 07:00 AM   #2
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Well the answer to question #1, is almost certainly, the indentation. YAML requires specific indentation of lines. Try this:

Code:
version: '3'
services:
 web:
  image: nginx:latest
 ports:
  - "8080:80"
 volumes:
  - ./src:/usr/share/nginx/html
 links:
  - php
 php:
  image: php:7-fpm
 
2 members found this post helpful.
Old 03-14-2024, 06:34 AM   #3
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by des_a View Post
Well the answer to question #1, is almost certainly, the indentation. YAML requires specific indentation of lines. Try this:

Code:
version: '3'
services:
 web:
  image: nginx:latest
 ports:
  - "8080:80"
 volumes:
  - ./src:/usr/share/nginx/html
 links:
  - php
 php:
  image: php:7-fpm
Hi,
Thanks.
How about other questions?
 
Old 03-14-2024, 09:05 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
"The powers that be" decided that a new thread was "a duplicate," but a few new questions were asked, so let's look at them here:

Quote:
1- In an internet article, a file called docker-compose.yaml was created to build the container. Can I create a YAML file for each container and use docker compose up -d to run it? If this is possible, how can I specify the input file?

2- I want to start a website that uses Nginx web server and PHP and JavaScript programming languages. Do I need a container for each (Nginx, PHP and JavaScript)?
[...]
4- I have created a container and now I want to make some changes in the YAML file and apply these new changes to the container. What should I do?

5- Is there a special folder for making containers? For example, the /var/www directory is for the web server.
The short-answer is: "there is no 'right' answer." But, a key idea of Docker is that you can "simply grab stuff 'off the shelf,' and not bother to read the ingredients label." For instance, there are many "canned" container definitions for – a MySQL server, an Nginix server, and a PHP server that is intended to be talked-to by Nginix. (Notice that there is not "all in one ..." Although of course there could be.) Usually, what you want to do is to "simply, string together" these "cans." And, there are plenty of existing websites and tutorials which will show you exactly how to do that. "Do what they did, and be happy."

Be mindful, as you are using "containers," that the container occupant does not "see" the host system. Instead, it sees the filesystem and the network that you specify. But, once again, there have now evolved "accepted standards" as to how you probably should set the host system up. Don't carve brand-new paths in a nearby field when there is a road nearby. "That's why you have decided to use Docker!"

Docker is not, per se, "an entirely-new 'container system.'" Even though, today, it is. (Originally, it used "lxc/lxd.") Basically, it consists of "convenient packaging." Tens of thousands of us(!) are basically out there doing the same thing. So, "somebody built a power-tool." Like Docker.

Because: "Actum Ne Agas: Do Not Do A Thing Already Done."

Last edited by sundialsvcs; 03-14-2024 at 09:15 AM.
 
Old 03-14-2024, 09:48 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,852

Rep: Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310
there was life before containers. You do not need to use containers at all, but you may use them if you find them useful. As usual.
You need to learn how to do things, you need to understand how they work. What is the purpose of that yaml file, what contains a container and how can you build and update it. All these things are very well documented and I can only repeat those sites.
What's the point of all this if you don't understand anything out of it?
 
Old 03-14-2024, 02:18 PM   #6
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Hello,
Thanks, but I did not receive answers to my questions.
 
Old 03-15-2024, 09:14 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
I think you actually did.

Here’s what I suggest: search for any one of the many dozens of tutorials which show you, step by step, how to “set up LAMP in Docker.” Follow their instructions explicitly. And, as you do so, carefully notice which Docker packages they selected – and why. Yes, there’s a bit of a learning curve for you to simply get past.

The entire idea behind “Docker” is to fully-automate, as much as possible, the steps that “we all have to do.” Of course it’s not the only way, but it’s convenient. I strongly encourage you then to “peek inside” each of the packages to see exactly what they did. “How was the trick done?”
 
Old 03-16-2024, 03:17 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,852

Rep: Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310
Quote:
Originally Posted by Jason.nix View Post
Hello,
Thanks, but I did not receive answers to my questions.
which one?
 
Old 03-17-2024, 12:25 AM   #9
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Quote:
Originally Posted by Jason.nix View Post
Hello,
Thanks, but I did not receive answers to my questions.
OK. Then try these two, before you do anything else. They are also how I learned. The next other best thing I can do for you, if you watch these and don't find any helpful answers, is show you my searches, which I will do here too, and then, if you still need help, upload my linux command file, of linux commands I know. It doesn't contain all docker knowlege I have, but I'd be surprised you didn't find what you were looking for, by the time I did all that, but first if you watch those videos.

I haven't built anything with docker yet (working on it), it's new to me too. I admit I haven't yet found a good use for docker-compose. However, I'm still pretty dangerous with docker. I know it took some time, but I will be able to build what I'm trying to build in a few months (save the Linux Active Directory Server - That's a bit much for me for now). I admit I will need some help here and there. HOWEVER, I CAN DO WHAT I'M TRYING TO DO, ableit a learning curve. If I can, others can too, if you're already at the level you show from trying to write the file. Just to be complete, I will try to find again and link a server building website I learned from ages ago! I'll have to do so in the next post, this is getting too long. But if they helped me, they should help you too, again, judging from the level you shown by trying the file. If you were at an earlier level, you probably couldn't put the file together. I also don't know where you stand with overall linux knowlege, but first of all, that's why I'm trying to give back, because it's a way to help, and I now know quite a bit. But I DID go to school pretty short ago too.

But basically, at my level, I can't give you the answer. But I can tell you where to look. I would give you them if I had them. And then, after I've done as much as I said, if I even need to complete those steps, there's nothing else I can do for you, so then I will go silent. But I do think that since you're still posting here, that I can do that much.

If someone knows where the other thread is, better link them together, unless you instruct me not to post, when they are posting so constantly. But to everyone, if I do this that I'm thinking, and it still doesn't help, there's nothing more I can do. Short of learning to give classes, but right now, I can't open the classes I give up to the public. I can't afford the costs to do that right now, and I'm not making any money at those classes. Here goes in the next post...
 
Old 03-17-2024, 12:32 AM   #10
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
How to do server work with docker:

https://www.youtube.com/watch?v=3c-iBn73dDE

https://www.youtube.com/watch?v=pTFZFxd4hOI

https://www.youtube.com/results?sear...+for+beginners


How to do some server work manually (a basic server):

https://www.howtoforge.com/tutorial/...and-ispconfig/

That's step #1. Try to use these first. If those don't answer all your questions, then please tell me, but make effort to use them first. Then, if it doesn't, I will upload my linux command file, if it lets me. If that doesn't work, then I'll be at the point of going silent probably.

Hopefully this helps though, though I can't give you the exact timeframe where they talk about docker compose.
 
Old 03-17-2024, 12:34 AM   #11
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
This is also, one of my best and most helpful threads, I think, so if you found some help because of it, try to up my rep if you know how. I'm not sure I know how, but I would think it's done by clicking on the rep link. I haven't messed with that so far, but I'd like to start learning the rep, and get more rep, WHEN I'M HELPFUL.
 
Old 03-18-2024, 08:05 PM   #12
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
But, let me also interject this:

"Docker" (!!) "Containers!" The two are not the same.

"Docker" is designed to create very-convenient packaging, within – shall I say, "on top of" – a "containerized" environment, for "the things that we most-commonly do." For example, "setting up a LAMP plus MySQL plus FastCGI server." Boom. Install a few packages and just sit back and watch it work.

"Extra-credit points" if you delve into the internal workings of any of them to see exactly how they work. (Old-schoolers like me might refer to this as "a MACRO facility," and they would also know why I used "all caps" or a particular typeface.) But, a helluva lot of people out there, now, don't have any need to do so, and that is precisely the point. "Good for them."

Docker, of course, turned out to be "a huge success" in a pragmatic commercial world which needs to "quickly and reliably" deploy identical copies of the same thing, without investing "human time" and exposing itself to "human error." (Sound familiar?) Download "a package" – or "build one" as the case may be – and, there you go. Can you describe your system's requirements in terms of "it needs [these] 'library Docker containers?'" "Good for you," especially when you shop for certain flavors of "cloud hosting" (which were built with this in mind ...).

Programmers worked very quickly to enable you to "reap Docker goodness," regardless (as much as possible ...) of your "host operating-system type." And they generally succeeded. "But, I digress."

But there are other ways to approach this (in Linux). For example, "lxc/lxd" provides something much closer to a "bare virtual machine." (And, in fact, "Docker" started out by using this as its foundation.)

As always, "the beauty of Linux is: choice." (And, yeah: "power tools.")

Last edited by sundialsvcs; 03-18-2024 at 08:19 PM.
 
Old 03-20-2024, 04:25 PM   #13
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Quote:
"Docker" is designed to create very-convenient packaging, within – shall I say, "on top of" – a "containerized" environment, for "the things that we most-commonly do." For example, "setting up a LAMP plus MySQL plus FastCGI server." Boom. Install a few packages and just sit back and watch it work.
...And that's why I included a link to "The Perfect Server"...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Difference between docker.io, docker-cd, and Docker Desktop LXer Syndicated Linux News 0 08-15-2022 05:39 PM
[SOLVED] Returning to Slackware after a few years, but I have a few questions pocker Slackware 14 04-19-2021 02:22 PM
LXer: Ubuntu LXD: Not a Docker replacement, a Docker enhancement LXer Syndicated Linux News 0 11-05-2014 08:40 PM
LXer: Docker Founder Explains What Docker is all About LXer Syndicated Linux News 0 08-21-2014 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 07:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration