- NAME
-
- gcloud beta compute instances update-container - updates Google Compute engine virtual machine instances running container images
- SYNOPSIS
-
-
gcloud beta compute instances update-containerINSTANCE_NAME[ --container-image=CONTAINER_IMAGE][ --container-mount-disk=[mode=MODE],[mount-path=MOUNT-PATH],[name=NAME],[partition=PARTITION]][ --container-privileged][ --container-restart-policy=POLICY][ --container-stdin][ --container-tty][ --zone=ZONE][ --clear-container-args| --container-arg=CONTAINER_ARG][ --clear-container-command| --container-command=CONTAINER_COMMAND][ --container-env=[KEY=VALUE, …,…]--container-env-file=CONTAINER_ENV_FILE--remove-container-env=[KEY,…]][ --container-mount-host-path=[host-path=HOSTPATH,mount-path=MOUNTPATH[,mode=MODE],…]--container-mount-tmpfs=[mount-path=MOUNTPATH,…]--remove-container-mounts=[MOUNTPATH[,MOUNTPATH,…],…]][ GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
(BETA)gcloud beta compute instances update-containerupdates Google Compute Engine virtual machines that runs a Docker image. For example:$ gcloud beta compute instances update-container instance-1 \ --zone us-central1-a \ --container-image=gcr.io/google-containers/busyboxupdates an instance called instance-1, in the us-central1-a zone, to run the 'busybox' image.
For more examples, refer to the
EXAMPLESsection below. - POSITIONAL ARGUMENTS
-
INSTANCE_NAME- Name of the instance to update. For details on valid instance names, refer to the criteria documented under the field 'name' at: https://cloud.google.com/compute/docs/reference/rest/v1/instances
- FLAGS
-
--container-image=CONTAINER_IMAGE-
Sets container image in the declaration to the specified value.
Empty string is not allowed.
--container-mount-disk=[mode=MODE],[mount-path=MOUNT-PATH],[name=NAME],[partition=PARTITION]-
Mounts a disk to the container by using mount-path or updates how the volume is
mounted if the same mount path has already been declared. The disk must already
be attached to the instance with a device-name that matches the disk name.
Multiple flags are allowed.
name- Name of the disk. Can be omitted if exactly one additional disk is attached to the instance. The name of the single additional disk will be used by default.
mount-path- Path on container to mount to. Mount paths with spaces and commas (and other special characters) are not supported by this command.
partition- Optional. The partition of the disk to mount. Multiple partitions of a disk may be mounted.
mode-
Volume mount mode:
rw(read/write) orro(read-only). Defaults torw. Fails if the disk mode isroand volume mount mode isrw.
--container-privileged- Sets permission to run container to the specified value.
--container-restart-policy=POLICY-
Sets container restart policy to the specified value.
POLICYmust be one of:never,on-failure,always. --container-stdin-
Sets configuration whether to keep container
STDINalways open to the specified value. --container-tty- Sets configuration whether to allocate a pseudo-TTY for the container to the specified value.
--zone=ZONE-
Zone of the instance to update. If not specified, the user may be prompted to
select a zone.
gcloudwill attempt to identify the zone by searching for resources in the user's project. If the zone cannot be determined, the user will then be prompted with all Google Cloud Platform zones.To avoid prompting when this flag is omitted, the user can set the
property:compute/zone$ gcloud config set compute/zone ZONE
A list of zones can be fetched by running:
$ gcloud compute zones list
To unset the property, run:
$ gcloud config unset compute/zone
Alternatively, the zone can be stored in the environment variable
.CLOUDSDK_COMPUTE_ZONE -
At most one of these may be specified:
--clear-container-args-
Removes the list of arguments from container declaration.
Cannot be used in the same command with
--container-arg. --container-arg=CONTAINER_ARG-
Completely replaces the list of arguments with the new list. Each argument must
have a separate --container-arg flag. Arguments are appended the new list in the
order of flags.
Cannot be used in the same command with
--clear-container-arg.
-
At most one of these may be specified:
--clear-container-command-
Removes command from container declaration.
Cannot be used in the same command with
--container-command. --container-command=CONTAINER_COMMAND-
Sets command in the declaration to the specified value. Empty string is not
allowed.
Cannot be used in the same command with
--clear-container-command.
--container-env=[KEY=VALUE, …,…]-
Update environment variables
KEYwith valueVALUEpassed to container.-
Sets
KEYto the specified value. -
Adds
KEY=VALUE, ifKEYis not yet declared. -
Only the last value of
KEYis taken whenKEYis repeated more
-
Sets
Values, declared with
--container-envflag override those with the sameKEYfrom file, provided in--container-env-file.--container-env-file=CONTAINER_ENV_FILE-
Update environment variables from a file. Same update rules as for
--container-envapply. Values, declared with--container-envflag override those with the sameKEYfrom file.File with environment variables declarations in format used by docker (almost). This means:
- Lines are in format KEY=VALUE
- Values must contain equality signs.
- Variables without values are not supported (this is different from
- If # is first non-whitespace character in a line the line is ignored
--remove-container-env=[KEY,…]-
Removes environment variables
KEYfrom container declaration Does nothing, if a variable is not present. --container-mount-host-path=[host-path=HOSTPATH,mount-path=MOUNTPATH[,mode=MODE],…]-
Mounts a volume by using host-path.
-
Adds a volume, if
mount-pathis not yet declared. -
Replaces a volume, if
mount-pathis declared.
-
Adds a volume, if
host-path,mount-path,mode) are completely replaced.host-path-
Path on host to mount from.
mount-path- Path on container to mount to. Mount paths with spaces and commas (and other special characters) are not supported by this command.
mode-
Volume mount mode: rw (read/write) or ro (read-only).
Default: rw.
--container-mount-tmpfs=[mount-path=MOUNTPATH,…]-
Mounts empty tmpfs into container at MOUNTPATH.
mount-path- Path on container to mount to. Mount paths with spaces and commas (and other special characters) are not supported by this command.
--remove-container-mounts=[MOUNTPATH[,MOUNTPATH,…],…]-
Removes volume mounts (
host-path,tmpfs,disk) withmountPath: MOUNTPATHfrom container declaration.Does nothing, if a volume mount is not declared.
- GCLOUD WIDE FLAGS
-
These flags are available to all commands: --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account,
--log-http, --project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run
$ gcloud helpfor details. - EXAMPLES
-
To run the gcr.io/google-containers/busybox image on an instance named
'instance-1' that executes 'echo "Hello world"' as a run command, run:
$ gcloud beta compute instances update-container instance-1 \ --container-image=gcr.io/google-containers/busybox \ --container-command='echo "Hello world"'To run the gcr.io/google-containers/busybox image in privileged mode, run:
$ gcloud beta compute instances update-container instance-1 \ --container-image=gcr.io/google-containers/busybox \ --container-privileged - NOTES
-
This command is currently in BETA and may change without notice. These variants
are also available:
$ gcloud compute instances update-container $ gcloud alpha compute instances update-container
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-02-04.


