Docker is one of the most popular container technology, which automates the deployment of applications by packaging an application with all of its dependencies into software containers. A good introduction to docker can be found here. Download the Docker engine here. The difference between docker containers and typical Virtual Machines (VMs):
-
docker pull <image>:latest
. The taglatest
is not required. Clone the container appropriate for your use case, for eg., usecentos
for the latest version of CentOS. CentOS and most other linux operating systems are available as official repositories from the Docker Hub. -
To use non-official docker images, you need to add the organisation before the docker image, for example to pull the latest version of
tensorflow
:docker pull tensorflow/tensorflow:latest
- The docker image can be used directly from the Docker Hub
- To launch the
centos
docker container, rundocker run -ti tensorflow/tensorflow:latest /bin/bash
docker run -ti -v /home/<user>/<mounted-folder>/:/<path-in-container> cbgeo/cb-geo:latest
docker exec -ti <containerid> /bin/bash
docker start <containerid>
docker stop <containerid>
docker rm <containerid>
, stop the container before deleting it.- To delete all docker containers
docker rm $(docker ps -a -q)
- To connect to a particular port (for e.g., 3000) in docker container to port
3000
in localhost:docker run -ti -p 3000:3000 tensorflow/tensorflow
- Launching docker as root user:
docker exec -u 0 -ti <containerid> /bin/bash
- To build an image from docker file run as root
docker build -t "tensorflow/tensorflow" /path/to/Dockerfile
docker history
will show you the effect of each command has on the overall size of the file.