Skip to content

Installation Docker

Arthur Masson edited this page May 6, 2020 · 4 revisions

Docker

Install docker on your machine (https://docs.docker.com/)

Make sure docker has enough memory to run Shanoir (6Gb should be enough) On OS X check the dashboard > preferences > resources > allocate 6Gb of memory

if you are using a Windows version below Windows 10, please read first Docker installation on Windows X < Windows 10

Docker installation on Linux (Ubuntu):

Follow the instructions : https://docs.docker.com/engine/installation/linux/ubuntu/

1- Once docker is installed and the service is running, make sure it is taking the correct arguments by running the following commands:

ps -edf | grep dockerd

If the output is the following, your environment will probably not work

root 10494 1 1 10:20 ? 00:00:01 /usr/bin/dockerd -H fd://

2- In that case, edit the file /etc/default/docker and add this line:

DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"

sudo service docker stop

sudo service docker start

3- Make sure the daemon takes the correct arguments by running the following commands again:

ps -edf | grep dockerd

If the output is the following, your environment is properly configured

root 10494 1 1 10:20 ? 00:00:01 /usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock

If the output is still like in step 1., then do the following:

sudo vi /lib/systemd/system/docker.service

Replace Type=notify with EnvironmentFile=-/etc/default/docker

Replace ExecStart=/usr/bin/dockerd -H fd:// with ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS

Save the file.

and run the following command:

sudo systemctl daemon-reload

sudo service docker stop

sudo service docker start

Make sure the daemon takes the correct arguments by running the following commands again:

ps -edf | grep dockerd

If the output is the following, your environment is properly configured

root 10494 1 1 10:20 ? 00:00:01 /usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock

Note : in order to be able to run docker without sudo, please run the following commands:

sudo gpasswd -a ${USER} docker

sudo service docker restart

and log off / log in to apply the changes or run newgrp docker in your terminal

Docker installation on Windows X < Windows 10:

For Windows versions below Windows 10 you have to use the docker-toolbox (see installation instructions on docker website). docker-toolbox ships with a VirtualBox, where inside is the default docker vm. As a result of this your docker containers are somehow imprisoned inside the vm. Therefore to access the Redis container within the docker vm on port 6379, we have to configure a port forwarding within VirtualBox to connect the localhost port 6379, that is used by Spring Session to find Redis, with the port inside the default vm. Follow the instructions below:

At this time Docker Machine is a virtual machine running under VirtualBox in your machine, so to expose your application port you need to map your virtual machine port to your host port.

To achieve this there are two options, but before make sure your Docker Machine is stopped running:

docker-machine stop default # see PS below if docker machine isn't default

Option 1 - Use the VirtualBox interface

  • Open VirtualBox Manager
  • Select your Docker Machine VirtualBox image (e.g.: default)
  • Open Settings -> Network -> Advanced -> Port Forward
  • Add your app name, the desired host port (e.g.: 80) and your Guest port (e.g.: 3000)

Option 2 - Use the VirtualBox command line

  • Just run the following command with your own parameters:
  • VBoxManage modifyvm "dev" --natpf1 "myapp,tcp,,80,,3000"
  • Final considerations

Now you can start your Docker Machine running:

Setup the docker machine (Windows & MAC only)

This section might be deprecated with the latest release of docker when using Hyper-V.

You could find doc on the docker machine here

We work with host "default".

Default host is installed with docker engine

On your CLI, load docker environment of host "default":

  • docker-machine env default

Create network

You could find doc on network here

Create a custom bridge network with command:

  • docker network create --driver bridge shanoir_ng_network

All containers of the project will be added to this network. They could communicate together by their name.

Clone this wiki locally