Möchten Sie erfahren, wie Sie mehrere Dienste in einem Container ausführen? In diesem Tutorial zeigen wir Ihnen alle Schritte, die erforderlich sind, um mehrere Dienste in einem Docker-Container auf einem Computer mit Ubuntu Linux auszuführen.

• Ubuntu 18.04
• Ubuntu 19.10
• Docker 19.03.6

In unserem Beispiel führt ein Docker-Container den MySQL-Dienst und den Apache-Dienst aus.

Der Apache-Dienst überwacht den TCP-Port 80.

Der MySQL-Dienst überwacht den TCP-Port 3306.

Docker - Verwandtes Tutorial:

Auf dieser Seite bieten wir Zugriff auf eine Liste von Tutorials im Zusammenhang mit Docker.

Tutorial Docker - Multiple services on a Container

Install the Docker package.

Download the Ubuntu docker image.

Start a new Ubuntu container.

In our example, a new Ubuntu container was created.

The container name is MYCONTAINER and its ID is 62f9adcafb62.

On the container command-line, install a list of required packages.

Install the Apache service with PHP support enabled.

Configure the desired timezone.

In our example, we configured the Brazilian Timezone from São Paulo.

Copy to Clipboard

Install the MySQL service.

Copy to Clipboard

Edit the MySQL configuration file named mysqld.cnf.

Copy to Clipboard

Locate the following line.

Copy to Clipboard

Change its value to 0.0.0.0.

Copy to Clipboard