Skip to main content

Use Docker on the Cloud

Launch Instance with Docker

Right now if you want to use Docker on the cloud, you need to select docker container before launching the instance. img.png

Install Docker

apt update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu/ \
$(lsb_release -cs) \
stable"
apt-get update && apt-get install -y docker-ce-cli

Verify Docker Installation

(base) root@notebook-1a62dca9-92b6-11ef-b741-c663643c702b-0:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

Notes

  • You can build your own Docker image on cloud and upload it to the cloud.
# first upload your image using scp or sftp to the instance
scp -P instance_port </path/to/local/file> root@instance_ip:<destination path>
# then load the image to docker
docker load -i <destination path>(e.g. /root/your_image.tar.gz)
  • docker data is not persistent if the instance is stopped or terminated. Please store your images in remote storage if needed.
docker save -o <destination path> <image_name>
cp <destination path> /root/dataDisk/
  • You can directly mount the GPU from the instance into the container when using docker run without needing to specify the --gpus parameter; the GPU is shared between the instance and the docker container.
  • Currently, only the /root path (including subpaths like /root/xxx) on the instance can be mounted into the container, e.g. docker run -v /root:/root. Other paths are not supported for mounting at this time.
  • Privileged mode is also not supported for now.
  • The Docker will not be enabled when starting up with CPU instances.