Install Basics
Install Docker and Docker Compose
To install Docker-CE (Community Edition) and Docker Compose, you can open the terminal, or SSH into your host system, then use the command
curl https://get.docker.com | sh
You'll be prompted to enter you super user password, then the install should commence.
NOTE: If you are using a system without sudo installed, you should install it, as this command seems to require it, even if you're logged in as root, which you really shouldn't be.
If you happen to be using a Linux version that isn't supported by this one-liner command, you can find instructions to install Docker-CE and Docker Compose for your distro with a quick web search.
Finally, let's add our user to the docker group. This will allow us to use the docker
and docker compose
commands without using sudo
every time. Use the command:
sudo usermod -aG docker <username>
Where you'll replace <username>
with your actual name / username. In my case I would use
sudo usermod -aG docker brian
Now, you can either log out and back in to get the new group to take effect, or you can use the command:
newgrp && newgrp docker
which will allow you to act as part of the docker
group temporarily until you can log out and back in later.
Create a Non-Root User with sudo Privileges
Add a Non-Root User
On Ubuntu / Debian based systems, creating a non-root user with sudo privileges is quite straight forward.
First, we'll create our non-root user with the command
adduser <username>
where you replace <username>
above with your actual name or username. In my case I would do
adduser brian
Enter a strong password for your user, then confirm the password. Enter the additional information if you like, though it's not required. Finally, accept the settings with 'Y'.
Add the user to the sudo group
To add our user to the sudo
group we'll use the command:
usermod -aG sudo <username>
Where, again, you'll replace <username>
with your name or username. In my case it would be
usermod -aG sudo brian
Now, you can log out and log back in as your new non-root user.