Hands-On Reinforcement Learning with Python
上QQ阅读APP看书,第一时间看更新

Installing Docker

After installing Anaconda, we need to install Docker. Docker makes it easy to deploy applications to production. Say you built an application in your localhost that has TensorFlow and some other libraries and you want to deploy your applications into a server. You would need to install all those dependencies on the server. But with Docker, we can pack our application with its dependencies, which is called a container, and we can simply run our applications on the server without using any external dependency with our packed Docker container. OpenAI has no support for Windows, so to install OpenAI in Windows we need to use Docker. Also, the majority of OpenAI Universe's environment needs Docker to simulate the environment. Now let's see how to install Docker. 

To download Docker, go to https://docs.docker.com/ where you will see an option called Get Docker; if you select that, you will see options for different operating systems. If you are using either Windows or Mac, you can download Docker and install it directly using the graphical installer.

If you are using Linux, follow these steps:

Open your Terminal and type the following:

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

Then type:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

And then type:

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Finally, type:

sudo apt-get update
sudo apt-get install docker-ce

We need to be a member of the Docker user group to start using Docker. You can join the Docker user group via the following command:

sudo adduser $(whoami) docker
newgrp docker
groups

We can test the Docker installation by running the built-in hello-world program:

sudo service docker start
sudo docker run hello-world

In order to avoid using sudo to use Docker every time, we can use the following command:

sudo groupadd docker
sudo usermod -aG docker $USER sudo reboot