In this tutorial, I will show you how to install Docker and Portainer on a Linux machine such as CentOS or Ubuntu.
The process is quite simple. You can copy and paste the code snippets below, and it should work directly.
My goal is to run various applications at the end. Using a graphical interface, I will create and save my scripts in a YAML file.
Additionally, Portainer offers many advantages for easily overseeing and managing my containers.
Various applications can be loaded into the containers, such as Nextcloud, NGINX Manager, PHP, Apache, MySQL, Oracle Database, and Oracle APEX.
Later on, I will show you how to install and configure the Oracle Database and Oracle APEX in a container.
Step 1: Setting up Docker
1. Add the Repository Key
First, we need to add the GPG key for the Docker repository to ensure the authenticity of the downloaded packages.
2. Add the Docker Repository
Next, we add the Docker repository to the package sources so that we can install Docker from the official repository.
3. Install Docker
Now, we update the package lists and install Docker.
4. Start and Enable Docker Services
Finally, we start the Docker service and enable it to start automatically at system boot.
Step 2: Setting up Portainer
1. Create a Docker Volume for Portainer
A Docker volume allows us to persist data even if the container is restarted or deleted. We create a volume for Portainer.
2. Start the Portainer Container
Now, we start the Portainer container. Portainer is a lightweight management UI that allows us to easily manage our Docker environment.
Explanation of the above command:
-d
: Runs the container in detached mode (in the background).-p 8000:8000 -p 9000:9000
: Maps ports 8000 and 9000 of the container to the same ports on the host.--name=portainer
: Names the container "portainer".--restart=always
: Ensures that the container always restarts if it crashes or the host is rebooted.-v /var/run/docker.sock:/var/run/docker.sock
: Binds the host's Docker socket into the container, allowing Portainer to manage Docker.-v portainer_data:/data
: Binds the previously created volume into the container to persist data.
3. Access the Portainer Web Interface
After setup, you can access Portainer via the following IP in your browser:
4. Configure Portainer
It is best to go to the settings, then to configuration, and then to Public IP. There, you can enter the respective IP or domain name as needed.
Finally, under Settings → Environments → Configuration → Public IP, enter the IP:
192.168.178.122
Then you can click directly on the container port and access the graphical interface without constantly entering the IP in the browser URL.
Next Steps
- Set up Docker and Portainer: Follow the steps above to install Docker and Portainer on your Ubuntu system.
- Configure Portainer: Access the Portainer web interface and configure it according to your needs.
- Install additional applications: In future articles, I will show you how to install additional applications via Portainer.
As you have now seen, it is quite easy to install Portainer on a Linux machine.
In further articles, I will show you how to install additional applications via Portainer or the graphical interface.
{fullWidth}
0 $type={blogger}:
Kommentar veröffentlichen