Would you like to learn how to install Apache using Docker on Ubuntu Linux? In this tutorial, we are going to show you all the steps required to perform the Apache installation using Docker on a computer running Ubuntu Linux in 5 minutes or less.
• Ubuntu 20.04
• Ubuntu 18.04
• Ubuntu 19.04
• Apache 2.4.46
Copyright © 2018-2021 by Techexpert.tips.
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the publisher.
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Apache – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Apache.
Tutorial Apache – Docker Installation on Ubuntu Linux
Install the Docker service.
Download the Apache docker image from the online repository.
List the Docker images installed on your system.
Here is the command output:
Start a new Apache container using this Docker image.
Here is the command output:
In our example, the Docker image was used to start a new container.
The new container is using the local port 80.
The container ID is 605238b70aad46ac80ef7a9013e5dbf376dbaad487130553c0a0db85c3847532
Congratulations! You have finished the Apache Docker installation on Ubuntu Linux.
Docker Apache – Persistent data
Create a docker volume for persistent data.
Verify the persistent data directory.
Here is the command output:
Optionally, create a symbolic link to an easier access location.
Start an Apache container with persistent data storage.
Verify the content of the persistent data directory.
Here is the command output:
Congratulations! You successfully configured the use of Docker persistent data storage.
Tutorial Apache – Testing the Docker installation
Open your browser and enter the IP address of your web server.
In our example, the following URL was entered in the Browser:
• http://192.168.100.10
The Apache server will display the default website.
Congratulations! Your Apache Docker installation was tested successfully.
Tutorial Apache – Docker container management
Verify the status of all Docker containers using the following command:
Here is the command output:
Verify the status of the Apache container using the ID or its name.
Here is the command output:
To stop the Apache container service, use the following command:
To start the Apache container service, use the following command:
To restart the Apache container service, use the following command:
In case of error, use the following command to verify the Apache container logs.
In our examples, we demonstrated how to manage the Apache container using its ID or the name previously defined.