{"id":84,"date":"2024-05-13T10:30:03","date_gmt":"2024-05-13T10:30:03","guid":{"rendered":"http:\/\/ssdnodes.billabailey.com\/2017\/05\/26\/tutorial-getting-started-with-docker-on-your-vps\/"},"modified":"2025-05-15T15:31:29","modified_gmt":"2025-05-15T15:31:29","slug":"getting-started-docker-vps","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/getting-started-docker-vps\/","title":{"rendered":"Install Docker On a VPS &#8211; Simple Step By Step Tutorial"},"content":{"rendered":"<p>Getting started with Docker on a VPS is pretty straightforward, and once you're set up via this Docker tutorial, it's like you've \"leveled up\" in DevOps.<\/p>\n<p>In this article, I will go through how Docker can benefit your VPS, how to install it, and how to use it.<\/p>\n<h2>Why Install Docker on a VPS?<\/h2>\n<p>Docker is a platform for designing, building, and launching \"containers,\" which are isolated environments containing all the software and configuration files necessary to run a service or application.<\/p>\n<p>Running Docker on<a href=\"http:\/\/ssdnodes.com\" target=\"_blank\" rel=\"noopener\"> your virtual server<\/a> gives you more stability, more flexibility, and a lot more ways to recover quickly if (or when) you mess things up.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9111\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-on-VPS.webp\" alt=\"docker vps\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-on-VPS.webp 768w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-on-VPS-300x200.webp 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>Installing Docker on your VPS brings significant benefits:<\/strong><\/p>\n<ul>\n<li>You can develop locally using a specific environment.<\/li>\n<li>You can ensure that local development environment is replicated exactly when you're ready to deploy code, ensuring 100% compatibility.<\/li>\n<li>Build Dockerfiles\/Docker images to make your site\/app portable to multiple VPSs for redundancy or fail-over.<\/li>\n<li>Host multiple applications on a single VPS without them interacting\u2014or conflict\u2014with one another. For example, run two WordPress installations with separate Apache\/Nginx web servers and separate MySQL databases.<\/li>\n<li>One container can crash without affecting other containers or the health of your VPS.<\/li>\n<li>Capability to automatically restart containers upon reboot of the VPS itself.<\/li>\n<li>A certain degree of improved security by separating different apps into different containers.<\/li>\n<li>Easy <a href=\"https:\/\/www.ssdnodes.com\/blog\/docker-backup-volumes\/\">backups<\/a>!<\/li>\n<\/ul>\n<p>With this, it's clear that having Docker on your VPS is a must. Now, let's get started on installing Docker and taking the first steps toward a container-powered VPS.<\/p>\n<div class=\"cta-inline\"><\/div>\n<h2>Prerequisites for Running Docker on a VPS<\/h2>\n<ul>\n<li>A virtual private server (VPS) running any of our available OS options. See <a href=\"https:\/\/www.ssdnodes.com\/pricing\/\" target=\"_blank\" rel=\"noopener noreferrer\">our pricing<\/a> for details.<\/li>\n<li>A <a href=\"https:\/\/www.ssdnodes.com\/blog\/connecting-vps-ssh-security\/\">non-root user account<\/a> (commands requiring escalated privileges will use <code>sudo<\/code>).<\/li>\n<\/ul>\n<h2>Step 1 - Installing Docker on Your VPS<\/h2>\n<div id=\"preview1\" class=\"g-b g-b--t1of2 split split-preview\">\n<div id=\"preview\" class=\"preview-html\">\n<h3><strong>Ubuntu 22.04\/Debian 12<\/strong><\/h3>\n<p>For both Ubuntu and Debian servers, the latest versions of Docker CE may not be available in the repositories. We need to install the prerequisite packages:<\/p>\n<pre><code><\/code><\/pre>\n<pre class=\"chroma\" tabindex=\"0\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\">sudo apt-get update\r\n<\/span><\/span><\/code><code>\r\nsudo apt-get install curl gnupg2 apt-transport-https ca-certificates software-properties-common <\/code><\/pre>\n<p>Next, we add the GPG keys, Docker repositories and finally install Docker. Here is where it gets different for both Ubuntu and Debian:<\/p>\n<h3><strong>Ubuntu<\/strong><\/h3>\n<pre><code><\/code><\/pre>\n<pre class=\"chroma\" tabindex=\"0\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\">sudo install -m <span class=\"m\">0755<\/span> -d \/etc\/apt\/keyrings\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\">sudo curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg -o \/etc\/apt\/keyrings\/docker.asc\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\">sudo chmod a+r \/etc\/apt\/keyrings\/docker.asc\r\n<\/span><\/span>\r\n<span class=\"line\"><span class=\"cl\"><span class=\"c1\"># Add the repository to Apt sources:<\/span>\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"nb\">echo<\/span> <span class=\"se\">\\\r\n<\/span><\/span><\/span><span class=\"line\"><span class=\"cl\">  <span class=\"s2\">\"deb [arch=<\/span><span class=\"k\">$(<\/span>dpkg --print-architecture<span class=\"k\">)<\/span><span class=\"s2\"> signed-by=\/etc\/apt\/keyrings\/docker.asc] https:\/\/download.docker.com\/linux\/ubuntu \\\r\n<\/span><\/span><\/span><span class=\"line\"><span class=\"cl\">  <span class=\"k\">$(<\/span>. \/etc\/os-release <span class=\"o\">&amp;&amp;<\/span> <span class=\"nb\">echo<\/span> <span class=\"s2\">\"<\/span><span class=\"nv\">$VERSION_CODENAME<\/span><span class=\"s2\">\"<\/span><span class=\"k\">)<\/span><span class=\"s2\"> stable\"<\/span> <span class=\"p\">|<\/span> <span class=\"se\">\\\r\n<\/span><\/span><\/span><span class=\"line\"><span class=\"cl\">  sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\">sudo apt-get update<\/span><\/span><\/code><\/pre>\n<pre><code><\/code><\/pre>\n<p>Then install docker:<\/p>\n<div class=\"preview\">\n<div class=\"preview__inner-1\">\n<div class=\"preview__inner-2\">\n<div class=\"cl-preview-section\">\n<pre><code>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3><strong>Debian<\/strong><\/h3>\n<pre><code><\/code><\/pre>\n<pre class=\"chroma\" tabindex=\"0\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\">sudo install -m <span class=\"m\">0755<\/span> -d \/etc\/apt\/keyrings\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\">sudo curl -fsSL https:\/\/download.docker.com\/linux\/debian\/gpg -o \/etc\/apt\/keyrings\/docker.asc\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\">sudo chmod a+r \/etc\/apt\/keyrings\/docker.asc\r\n<\/span><\/span>\r\n<span class=\"line\"><span class=\"cl\"><span class=\"c1\"># Add the repository to Apt sources:<\/span>\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"nb\">echo<\/span> <span class=\"se\">\\\r\n<\/span><\/span><\/span><span class=\"line\"><span class=\"cl\">  <span class=\"s2\">\"deb [arch=<\/span><span class=\"k\">$(<\/span>dpkg --print-architecture<span class=\"k\">)<\/span><span class=\"s2\"> signed-by=\/etc\/apt\/keyrings\/docker.asc] https:\/\/download.docker.com\/linux\/debian \\\r\n<\/span><\/span><\/span><span class=\"line\"><span class=\"cl\">  <span class=\"k\">$(<\/span>. \/etc\/os-release <span class=\"o\">&amp;&amp;<\/span> <span class=\"nb\">echo<\/span> <span class=\"s2\">\"<\/span><span class=\"nv\">$VERSION_CODENAME<\/span><span class=\"s2\">\"<\/span><span class=\"k\">)<\/span><span class=\"s2\"> stable\"<\/span> <span class=\"p\">|<\/span> <span class=\"se\">\\\r\n<\/span><\/span><\/span><span class=\"line\"><span class=\"cl\">  sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\r\n<\/span><\/span><span class=\"line\"><span class=\"cl\">sudo apt-get update\r\n<\/span><\/span><\/code><code>\r\n<\/code><\/pre>\n<p>Now install Docker:<\/p>\n<div class=\"preview__inner-2\">\n<div class=\"cl-preview-section\">\n<pre><code>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<h3>Other Linux Distributions<\/h3>\n<p>If you are using another Linux distribution, check out the <a href=\"https:\/\/docs.docker.com\/engine\/\" target=\"_blank\" rel=\"noopener\">official Docker documentation<\/a>.<\/p>\n<\/div>\n<\/div>\n<h2>Step 2 - Testing Your VPS Docker Installation<\/h2>\n<p>The people behind Docker recommend testing out your Docker installation with a basic <code>Hello world<\/code> command to ensure everything is working the way it should. If so, you'll see the following output:<\/p>\n<pre><code class=\"language-shell\">$ sudo docker run hello-world\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9112\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/hello-world-docker.webp\" alt=\"Docker on a VPS\" width=\"600\" height=\"326\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/hello-world-docker.webp 1000w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/hello-world-docker-300x163.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/hello-world-docker-768x417.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h2>Step 3 - Some Docker Post-installation Configurations<\/h2>\n<p>Now that Docker is installed, let's take a moment to make a few quality-of-life improvements. These will help make Docker a little easier to use on a day-to-day basis:<\/p>\n<ul>\n<li>Enable Docker to start automatically after a reboot.<\/li>\n<li>Allow the non-root user to manage Docker.<\/li>\n<\/ul>\n<h3>Enable Docker Service<\/h3>\n<p>In CentOS, Debian, and Ubuntu, <code>systemd<\/code> is responsible for managing which services start when the system boots up.<br \/>\nEnabling the Docker service means configuring it to start automatically after a reboot. To do this, you can enable the Docker daemon with <code>systemctl<\/code>\u00a0and make it automatically start on your VPS with a single command:<\/p>\n<pre><code class=\"language-shell\">$ sudo systemctl enable docker\r\n<\/code><\/pre>\n<p>Once the Docker service is set to start automatically upon rebooting your VPS, all Docker containers will also spin up automatically. All your apps running in Docker containers will come back online without any manual intervention.<\/p>\n<p>Once you have enabled the <code>docker<\/code> service itself, you do not need to take any further steps. This means that any application you run via Docker will gracefully restart after boot, potentially minimizing downtime (as long as the services <em>inside<\/em> the container are set up to start at boot themselves).<\/p>\n<h3>Docker Non-root Access<\/h3>\n<p>In order to give our non-root user access to the Docker management commands, we need to create a <code>docker<\/code> group (it may already be created for you), and then add your primary user to that group.<\/p>\n<pre><code class=\"language-shell\">$ sudo groupadd docker\r\n$ sudo usermod -aG docker $USER\r\n<\/code><\/pre>\n<p>Log out of your VPS by typing <code>exit<\/code> or <code>Ctrl+D<\/code> and log back in. Then, you can test whether or not you can use the <code>docker<\/code> command without prepending <code>sudo<\/code>.<\/p>\n<pre><code class=\"language-shell\">$ docker run hello-world\r\n<\/code><\/pre>\n<h2>Step 4 - Installing Docker-compose on Your VPS<\/h2>\n<p>Docker Compose is a tool that helps simplify the configuration and deployment of Docker containers and applications by using an easy-to-read <code>.yml<\/code>\/<code>.yaml<\/code> file. In some cases, this will be easier than writing out a lengthy command for the shell prompt.<\/p>\n<p>To install Docker Compose, first determine the latest version from the <a href=\"https:\/\/github.com\/docker\/compose\/releases\" target=\"_blank\" rel=\"noopener\">releases page<\/a>. At the time of writing, the current stable version is\u00a0<code>2.26.0<\/code>.<\/p>\n<div class=\"cl-preview-section\">\n<p>Create a new directory for Docker Plugins:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre><code>mkdir -p ~\/.docker\/cli-plugins\/\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Download the Docker Compose binary (Make sure to change\u00a0<code>2.26.0<\/code>\u00a0to the latest version):<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre><code>curl -SL https:\/\/github.com\/docker\/compose\/releases\/download\/v2.26.0\/docker-compose-linux-x86_64 -o ~\/.docker\/cli-plugins\/docker-compose\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Set<a href=\"https:\/\/www.ssdnodes.com\/blog\/linux-permissions\/\"> execute permissions<\/a> to make the binary executable:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre><code>chmod +x ~\/.docker\/cli-plugins\/docker-compose\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Verify the installation:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre><code>docker compose version\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>You should see the version you installed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9113\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/compose-version.png\" alt=\"Docker on a VPS: Docker Compose\" width=\"600\" height=\"107\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/compose-version.png 1000w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/compose-version-300x53.png 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/compose-version-768x137.png 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<\/div>\n<h2>Step 5 - Testing Docker with a Basic LAMP Stack<\/h2>\n<p>Now we can get to the exciting bit\u2014getting started running some actual applications in Docker containers. No more <code>Hello, world<\/code>!<\/p>\n<p>We'll start by creating a very basic LAMP stack using the <code>php:apache<\/code> container available from Docker. But, before that, let's create a directory on the host to store our files, which we'll link to the <code>\/var\/www\/html<\/code> directory within the container.<\/p>\n<pre><code class=\"language-shell\">$ mkdir $HOME\/apache &amp;&amp; cd $HOME\/apache\r\n<\/code><\/pre>\n<p>Then, we can create a small PHP file named <code>info.php<\/code> that will display information about the PHP configuration. It's a <a href=\"http:\/\/php.net\/manual\/en\/function.phpinfo.php\" target=\"_blank\" rel=\"noopener\">standard method<\/a> of testing PHP-based installations.<\/p>\n<pre><code class=\"language-shell\">$ printf '&lt;?php\\nphpinfo();\\n?&gt;' &gt; info.php\r\n<\/code><\/pre>\n<p>Finally, we have our <code>docker<\/code> command. But, before you run it, check out the information just beneath the command so that you can understand exactly what it's accomplishing.<\/p>\n<pre><code class=\"language-shell\">$ docker run -d --name=apache -p 8080:80 -v $HOME\/apache:\/var\/www\/html php:apache\r\n<\/code><\/pre>\n<p>First, the <code>docker run<\/code> specifies that we are going to create and start a new container, and the <code>-d<\/code> option means we will \"detach\" from it, much the way one detaches from a <code>tmux<\/code> session or an <code>ssh<\/code> session. In cases where you want to immediately run commands <em>inside<\/em> the newly-created container, you can omit the <code>-d<\/code>.<\/p>\n<p>We use <code>--name=apache<\/code> to give the container a specific name. This is recommended, because your chosen names will be easier to manage and remember than the randomized defaults\u2014comes in handy when you want to stop or delete a container.<\/p>\n<p><code>-p 8080:80<\/code> will expose port <code>8080<\/code> to traffic arriving on the VPS, and will route that traffic to port 80 <em>on the container<\/em>. This makes it possible to expose different containers to different ports, and enable more complex configurations with an <code>nginx<\/code> reverse proxy.<\/p>\n<p><code>-v $HOME\/apache:\/var\/www\/html<\/code> is a virtual drive mapping. In this case, any files in the directory before the colon, <code>$HOME\/apache<\/code>, will be available in the <code>\/var\/www\/html<\/code> directory <em>inside the container<\/em>.<\/p>\n<p>And finally, <code>php:apache<\/code> tells <code>docker<\/code> which image to use. More images can be found on the <a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener\">Docker Hub<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9114\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-run-apache.webp\" alt=\"Docker run Apache on a VPS\" width=\"600\" height=\"158\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-run-apache.webp 1000w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-run-apache-300x79.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-run-apache-768x203.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>You should now be able to see that the container is running with the <code>docker ps<\/code> command:<\/p>\n<pre><code class=\"language-shell\">$ docker ps\r\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES\r\nd1fbdb7e0c5f        php:apache          \"docker-php-entryp...\"   3 seconds ago       Up 3 seconds        0.0.0.0:8080-&gt;80\/tcp   apache\r\n<\/code><\/pre>\n<p>You can now also access your basic Apache web server by visiting <code><a href=\"http:\/\/YOUR-SERVER-IP:8080\/info.php\" target=\"_blank\">http:\/\/YOUR-SERVER-IP:8080\/info.php<\/a><\/code> in your favorite browser. If all has gone correctly, you'll see something like the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9115\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/phpinfo.webp\" alt=\"Docker on a VPS with PHP\" width=\"600\" height=\"258\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/phpinfo.webp 946w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/phpinfo-300x129.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/phpinfo-768x330.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Now, for the sake of showing some more core <code>docker<\/code> commands, let's gracefully shut down this container, delete the container, followed by the image itself.<\/p>\n<pre><code class=\"language-shell\">$ docker stop apache\r\n$ docker rm apache\r\n$ docker rmi php:apache\r\n<\/code><\/pre>\n<p>You should receive the following output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9118\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-remove-1.webp\" alt=\"Docker on a VPS: Removing Containers\" width=\"600\" height=\"136\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-remove-1.webp 1000w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-remove-1-300x68.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/Docker-remove-1-768x174.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>For more, check out <a href=\"https:\/\/www.ssdnodes.com\/blog\/how-to-remove-docker-images-containers-and-volumes\/\">How To Remove Docker Images, Containers, and Volumes<\/a>.<\/p>\n<h2>Step 6 - Installing WordPress with Docker on Your VPS<\/h2>\n<p>Okay, we've gotten started with Docker and tested the LAMP stack.<\/p>\n<p>So, now let's take the LAMP stack a step further with a full-blown WordPress installation, and this time, let's also use <code>docker-compose<\/code> to make the process a little bit more human-readable.<\/p>\n<p>The first step is creating a new directory for this project.<\/p>\n<pre><code class=\"language-shell\">$ mkdir wp_test &amp;&amp; cd wp_test\r\n<\/code><\/pre>\n<p>Then, create a <code>docker-compose.yml<\/code> file that will specify the configuration. This will create two containers: one running Apache\/Wordpress, and another running the <code>mysql<\/code> instance, with data persisted between reboots and container shutdowns. Of course, for production use, you will want to change the passwords to be more secure.<\/p>\n<pre><code class=\"language-yaml\">version: '2'\r\n\r\nservices:\r\n   db:\r\n     image: mysql:5.7\r\n     volumes:\r\n       - db_data:\/var\/lib\/mysql\r\n     restart: always\r\n     environment:\r\n       MYSQL_ROOT_PASSWORD: somewordpress\r\n       MYSQL_DATABASE: wordpress\r\n       MYSQL_USER: wordpress\r\n       MYSQL_PASSWORD: wordpress\r\n     container_name: wp_test_db\r\n\r\n   wordpress:\r\n     depends_on:\r\n       - db\r\n     image: wordpress:latest\r\n     ports:\r\n       - \"8080:80\"\r\n     restart: always\r\n     environment:\r\n       WORDPRESS_DB_HOST: db:3306\r\n       WORDPRESS_DB_USER: wordpress\r\n       WORDPRESS_DB_PASSWORD: wordpress\r\n     container_name: wp_test\r\nvolumes:\r\n    db_data:\r\n<\/code><\/pre>\n<p>To launch the container for the first time, use the <code>docker-compose up<\/code> command.<\/p>\n<pre><code class=\"language-shell\">$ docker compose up -d\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9117\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-compose-WP.webp\" alt=\"Docker on a VPS: Docker Compose WordPress\" width=\"600\" height=\"147\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-compose-WP.webp 1000w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-compose-WP-300x74.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2019\/05\/docker-compose-WP-768x188.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Now, you can check on these new containers using <code>docker ps<\/code>.<\/p>\n<pre><code class=\"language-shell\">$ docker ps\r\n20570a5eb798        wordpress:latest    \"docker-entrypoint...\"   3 seconds ago       Up 2 seconds        0.0.0.0:8080-&gt;80\/tcp   wp_test\r\nc1872cb1443d        mysql:5.7           \"docker-entrypoint...\"   3 seconds ago       Up 3 seconds        3306\/tcp               wp_test_db\r\n<\/code><\/pre>\n<p>Of course, the WordPress installation is now available on <code><a href=\"http:\/\/YOUR-SERVER-IP:8080\" target=\"_blank\">http:\/\/YOUR-SERVER-IP:8080<\/a><\/code>, for you to begin the famous 5-minute installation. And, if for any reason, you need to shut down these containers <em>while retaining the data<\/em>, use <code>docker-compose down<\/code>.<\/p>\n<h2>Getting Started with Docker on Your VPS: Next Steps<\/h2>\n<p>With this, I hope you're excited to get started taking full advantage of Docker on your VPS.<\/p>\n<p>By offloading services to containers, you can keep your base OS cleaner, with fewer attack vectors, and with less risk of various applications conflicting with one another.<\/p>\n<p>Plus, it's much safer to make mistakes with containers! All you need to do is <a href=\"https:\/\/www.ssdnodes.com\/blog\/how-to-remove-docker-images-containers-and-volumes\/\">stop the container, remove it<\/a>, and try again, without worrying that you're cluttering up your system or potentially breaking it.<\/p>\n<p>If you want to get started leveling up your Docker skills, check out a few of our Docker tutorials:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.ssdnodes.com\/blog\/host-multiple-websites-docker-nginx\/\">Host multiple websites on one VPS with Docker and Nginx<\/a><\/li>\n<li><a href=\"https:\/\/www.ssdnodes.com\/blog\/host-multiple-ssl-websites-docker-nginx\/\">Hosting multiple SSL-enabled sites with Docker and Nginx<\/a><\/li>\n<li><a href=\"https:\/\/www.ssdnodes.com\/blog\/self-hosting-handbook\/\">Self-hosting with Docker: The definitive handbook<\/a><\/li>\n<\/ul>\n<p>Enjoy your containers! And, while it's <a href=\"https:\/\/blog.docker.com\/2013\/09\/docker-can-now-run-within-docker\/\" target=\"_blank\" rel=\"noopener\">definitely possible<\/a>, we can't recommend running Docker <em>inside<\/em> of Docker.<\/p>\n<h2>Additional resources:<\/h2>\n<ul>\n<li><a href=\"https:\/\/store.docker.com\/editions\/community\/docker-ce-server-debian\" target=\"_blank\" rel=\"noopener\">Docker Community Edition for Debian<\/a><\/li>\n<li><a href=\"https:\/\/store.docker.com\/editions\/community\/docker-ce-server-ubuntu\" target=\"_blank\" rel=\"noopener\">Docker Community Edition for Ubuntu<\/a><\/li>\n<li><a href=\"https:\/\/store.docker.com\/editions\/community\/docker-ce-server-centos\" target=\"_blank\" rel=\"noopener\">Docker Community Edition for CentOS<\/a><\/li>\n<li><a href=\"https:\/\/docs.docker.com\/engine\/installation\/linux\/linux-postinstall\/\" target=\"_blank\" rel=\"noopener\">Post-installation steps for Linux<\/a><\/li>\n<li><a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/docker\/\" target=\"_blank\" rel=\"noopener\">Docker command line<\/a><\/li>\n<li><a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener\">The Docker Hub<\/a><\/li>\n<li><a href=\"https:\/\/docs.docker.com\/compose\/wordpress\/\" target=\"_blank\" rel=\"noopener\">Quickstart: Compose and WordPress<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/veggiemonk\/awesome-docker\" target=\"_blank\" rel=\"noopener\">A curated list of Docker resources and projects<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Transform Your VPS with Docker: A Comprehensive Guide to Streamlining Development, Deployment, and Maintenance for Optimal DevOps Efficiency and Stability!<\/p>\n","protected":false},"author":19,"featured_media":9343,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[182],"class_list":["post-84","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials","tag-docker"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":29,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":12921,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/84\/revisions\/12921"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/9343"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}