How to Install Docker on Oracle Linux 7.7

I previously wrote an article on how to install Docker on CentOS 7. I’m going to write up an article for Oracle Linux 7.7 this time. It’s the same Docker after all, so the end result should be pretty much the same.

First of all, SSH into your VM on OCI.

$ ssh opc@[the public IP address]

Update the host.

$ sudo yum -y update

Install Docker.

sudo yum install -y docker-engine

Start Docker.

$ sudo systemctl start docker

Configure Docker to survive restarts.

$ sudo systemctl enable docker

Run hello-world container to test the Docker engine.

$ sudo docker run hello-world

Check the running (but exited) container.

$ sudo docker ps -a

Remove the container.

$ sudo docker rm [container ID]

List the local images.

$ sudo docker images

Remove the local image.

$ sudo docker rmi [image ID]

Recap

Wow, that was a breeze. I could have added Docker’s yum repository to install the latest and greatest bits but then I’d rather go with Oracle’s repo because the version must have gone through tests for Oracle Linux. This looks promising and I’m one step closer to hosting my WordPress blog on OCI.

SSH from Another Machine to a VM on Oracle Cloud Infrastructure

When you create an instance of VM, you provision it with your RSA public key on the machine where you were working at that time. Let’s imagine a situation where you want to access your VM on OCI but from another machine. Here are the steps you could take.

  1. Start terminal.
  2. Generate an RSA key using ssh-keygen if one doesn’t exist already on another machine where you want to SSH to the VM on OCI from.
  3. Run cat to print the public RSA key to your terminal. Make the public key available to the original machine that you used to access the VM on OCI.
    $ cat ~/.ssh/id_rsa.pub
  4. From the original machine where you already have an access to the VM on OCI, SSH to the VM.
    $ ssh opc@[the public IP address]
  5. Edit the file ~/.ssh/authorized_keys with vi.
    $ vi ~/.ssh/authorized_keys
  6. There should already be RSA public key in the file for your machine. Add the RSA key generated in step 3.

    Sorry if the image above is hard to comprehend. The text from the cursor below is the RSA public key for the new machine you want to access the OCI VM from.
  7. Save it and access the VM from the new machine.
    $ ssh opc@[the public IP address]

Recap

By adding public RSA key to authorized_keys file under ~/.ssh directory, you can access to the VM from another machine.