Reputation: 8893
I am trying to get docker images from Container Engine to run on a Compute Engine VM. On my laptop I can run gcloud docker pull gcr.io/projectid/image-tag
I just spun up a Debian VM on Compute Engine, but when I try to run any gcloud docker
command I get ERROR: (gcloud.docker) Docker is not installed.
> gcloud --version
Google Cloud SDK 140.0.0
alpha 2017.01.17
beta 2017.01.17
bq 2.0.24
bq-nix 2.0.24
core 2017.01.17
core-nix 2017.01.17
gcloud
gsutil 4.22
gsutil-nix 4.22
> gcloud docker --version
ERROR: (gcloud.docker) Docker is not installed.
https://cloud.google.com/sdk/gcloud/reference/docker makes it seem like gcloud docker
should work.
Am I supposed to install docker on the VM before running gcloud docker
?
Upvotes: 1
Views: 4291
Reputation: 12625
Per intuition i tried to install docker with sudo apt-get install docker
, but I was wrong, the actual docker package name is docker.io
, so I restarted the process and worked this way:
sudo apt-get install docker.io
sudo gcloud docker ps
sudo gcloud docker -- pull gcr.io/$PROJECT_NAME/$APPLICATION_IMAGE_NAME:latest
EXPOSE 8000
. For instance in the following example my app is configured to work at the 8000
port but it will be accessed by the public on the default www port, the 80
.sudo docker run -d -p 80:8000 --name=$APPLICATION_IMAGE_NAME \
--restart=always gcr.io/$PROJECT_NAME/$APPLICATION_IMAGE_NAME:latest
The --restart
flag will allow this container to be restarted every time the instance restarts
I hope it works for you.
Upvotes: 4
Reputation: 18200
Am I supposed to install docker on the VM before running gcloud docker?
Yes. The error message is telling you that Docker needs to be installed on the machine for gcloud docker
to work.
You can either install docker manually on your Debian VM or you can launch a VM that has docker pre-installed onto the machine, such as the Container-Optimized OS from Google.
Upvotes: 3