I am creating a compute engine with a container and I was expecting the compute engine to start the container once it launches. But it doesn't look like the container starts at all. Does create-with-container merely creates a compute engine with a container? If so, how do I tell it to start the container?
gcloud compute instances create-with-container instance-1 \
--container-image=us.gcr.io/foo/bar \
--zone=us-central1-c \
--machine-type="e2-micro" \
--scopes=storage-rw,compute-rw
EDIT: Your container should start when your VM starts. When passing --container-arg, use equal sign not space. e.g. --container-arg="--job_id=1" not --container-arg="--job_id 1"
In my case using space instead of equal sign inside the
--container-argmade my container not start correctly.Do
--container-arg="--job_id=1"not--container-arg="--job_id 1"My gcloud command:
My container runs fine with both equal sign (
docker run us.gcr.io/foo/bar --job_id=1) and space (docker run us.gcr.io/foo/bar --job_id 1) on my local machine and I am used to using space.