It's time to get really started...
If you still don't know what Docker is or what it does? Just read the official "What is docker" document!
In this part of the series, we're going to install Docker and Docker Compose - although Docker does not recommend to use Docker Compose for production use, we'll still give it a shot. If you've never heard of Docker Compose, let me tell you in a few words what it does.
Docker Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running. In short: You'll define a YAML file in which you'll specify how the Docker containers must be started and how they are linked together. Docker Compose will then start them for you and will make sure that they are started in the right order. It will also take care of naming these containers baed on your settings. But we'll get into that in one of the next parts.
Let's install Docker & Docker ComposeAs I've mentioned before, Docker requires a 64-bit installation regardless of your Ubuntu version. Additionally, your kernel must be 3.10 at minimum. The latest 3.10 minor version or a newer maintained version are also acceptable.
Run the following command, which will download a shell script and will trigger the installation of Docker. When running this command, it will ask you for your password. Just provide the password that you have set for johndoe in part 2 of this series.
# wget -qO- https://get.docker.com/ | shTo verify that Docker has been installed correctly, just type the following to see the options that you have when running Docker:
# sudo docker --helpNow let's install Docker Compose by typing the following:
# curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-composeLet's add johndoe to a new group called docker:
# chmod +x /usr/local/bin/docker-compose
# sudo usermod -aG docker johndoeNow you should be able to run docker containers without using sudo.
In order to start our service automatically when we reboot the system, we need to add it to the default runlevel:
sudo update-rc.d docker defaultsFinally we also need to setup our UFW again, so that it can work with docker, by exposing another port (remember we've done that already with the SSH port):
#sudo ufw allow 2375/tcpWe also need to change some UFW settings to make Docker work correctly:
# sudo vi /etc/default/ufwSet the DEFAULT_FORWARD_POLICY policy to:
DEFAULT_FORWARD_POLICY="ACCEPT"Reload UFW to use the new setting.
# sudo ufw reload
# sudo ufw status
To Action From
-- ------ ----
2233/tcp ALLOW Anywhere
2375/tcp ALLOW Anywhere