Hello,
I am a newbie and have some questions about the docker compose:
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)?
3- The following configuration file creates a container using image and connects the containers using links:
1- No, in your example, for every website you have, you would create a docker-compose file.
2- Depends, normally when working with containers, you should have 1 container pr application, meaning: 1 container for database, 1 container for webserver, 1 container for proxy and so on, javascript is client side so that isnt needed.
3- That starts an nginx and a php-fpm server, then its your job to configure nginx to USE the php-fpm via ngnix configuration files, to make it simple, you can use the build in php-apache image:
5- Every image has a default location, fx. the php:apache image i gave you an example on earlier, the web server is expected to see web files here: /var/www/html.
For each image you use, its normal that these kind of infomation is documented on hub, fx: Docker
Hi,
Thank you so much for your reply.
1- So, in the new version of docker compose, the -f parameter has been removed. I had seen examples like docker-compose -f docker-compose.prod.yml up -d on the internet. When I want to create a new container, should I delete the docker-compose.yaml file and create it with the new container settings?
2- If the JavaScript is server-side, then I have to create another container for it.
3- Why did you use version: '3'? Can this number be anything?
4- Does the following configuration file connect Nginx to PHP-FPM?
1- im pretty sure -f still exists, and no, you should not delete your compose file, the compose file is your recipe for your application, instead you should have different folders for each project
2- if you by javascript server side, mean nodejs or similar, then yes, there should be a container for it.