Skip to main content

Command Palette

Search for a command to run...

Docker (not Podman) & Docker compose for Oracle Compute

Updated
2 min read
Docker (not Podman) & Docker compose for Oracle Compute
M

With around 20 years on the job, Matt is one of the most experienced software developers at Pretius. He likes meeting new people, traveling to conferences, and working on different projects.

He’s also a big sports fan (regularly watches Leeds United, Formula 1, and boxing), and not just as a spectator – he often starts his days on a mountain bike, to tune his mind.

A blog for this? surely it's just the command below, right?

# Don't actually run this
# sudo dnf install docker

No, it doesn't. Because this command installs Oracle's flavour of Docker called podman-docker. Here is proof:

Podman might be fine for you, however, I had a problem where Podman containers could not resolve each other by container name. So instead of Podman, this blog is all about the installation of Docker-ce. Also known as Docker Community Edition & as a bonus we are going to get docker-compose running as an executable.

Docker compose is already supplied by Docker-ce as a plugin, but hey, I like the docker-compose command.

Install docker-ce

  1. Add centos repository and install docker-ce

     sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
     sudo dnf install docker-ce -y
    
  2. Start Docker

     sudo systemctl start docker
     sudo systemctl enable docker
    
  3. Allow docker to use reserved ports

     sudo groupadd docker
     sudo service docker restart
     sudo usermod -a -G docker opc
    
  4. IMPORTANT: Exit the session and start a new session

     exit
    
  5. Check Docker version

     docker --version
    

Install docker-compose

  1. Run the following

     sudo curl -L https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
     sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
     sudo chmod +x /usr/local/bin/docker-compose
    
  2. Check Docker version

     docker-compose --version
    

Test it out

  1. Get a Hello World example running on port 80

     docker run -P -d -p 80:80 --name hello_port_eighty nginxdemos/hello
    
  2. Wait 5 seconds and then type

     curl http://localhost:80
     docker rm -f hello_port_eighty
     docker rmi nginxdemos/hello
    
  3. If it worked, you should see the raw HTML from port 80. It looks a bit like this

     <p><span>Server&nbsp;address:</span> <span>172.17.0.2:80</span></p>
     <p><span>Server&nbsp;name:</span> <span>71357de631fa</span></p>
     <p class="smaller"><span>Date:</span> <span>09/Oct/2023:16:28:20 +0000</span></p>
     <p class="smaller"><span>URI:</span> <span>/</span></p>
     </div>
     <div class="check"><input type="checkbox" id="check" onchange="changeCookie()"> Auto Refresh</div>
         <div id="footer">
             <div id="center" align="center">
                 Request ID: c537f746356ac1ababdd362f2cea36c6<br/>
                 &copy; NGINX, Inc. 2018
             </div>
         </div>
     </body>
     </html>
    

ENJOY!

What's the picture? It's the village of Ripley. Visit Yorkshire!