A B C D E F G H I J K L M N O P Q R S T U V W X Z

Composer (PHP)

 

So you ran composer as root…

https://getcomposer.org/doc/01-basic-usage.md

https://php-de.github.io/jumpto/composer/#composer-installation

https://linuxize.com/post/how-to-install-and-use-composer-on-ubuntu-18-04/

Converting a Dockerfile to a docker-compose.yml

Let’s assume you have a folder structure for your project like this (directory names are bold) and it is a project thats exposing port 80:

(project root) /
├── index.html
├── script.js
├── style.css
└── Dockerfile

I would encourage you to put all your project related stuff to a subfolder (it is easier to keep track of what folder belongs to which container) so it looks like this:

(project root) /
└── Super cool project /
    ├── index.html
    ├── script.js
    ├── style.css
    └── Dockerfile

A very basic way to „convert“ (or more integrate) your Dockerfile into a docker-compose.yml is the following:

Create a file called „docker-compose.yml“ in your project’s root folder:

(project root) /
├── Super cool project /
│   ├── index.html
│   ├── script.js
│   ├── style.css
│   └── Dockerfile
└── docker-compose.yml

In your docker-compose.yml you now put in the following content:

version: "3.8"
services:
  super-cool-container:
    build: "./Super cool project"
    ports:
      - 80:80

Now you are already good to go! Just go to the folder where your docker-compose.yml is located and run the following command to start all the containers listed in this file as a service:

docker compose up -d

To shut down all the containers just run:

docker compose down

Now you’re good to go! If your container is started with more parameters  etc. you can look up the documentation for docker compose and have a look on how you have to edit your docker compose file to include those parameters.