gcloud_alpha_compute_instances_update-container (1)
NAME
- gcloud alpha compute instances update-container - updates Google Compute engine virtual machine instances running container images
SYNOPSIS
-
gcloud alpha compute instances update-container INSTANCE_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
(ALPHA) gcloud alpha compute instances update-container updates
-
$ gcloud alpha compute instances update-container instance-1 \
--zone us-central1-a \
--container-image=gcr.io/google-containers/busybox
updates an instance called instance-1, in the us-central1-a zone, to run the 'busybox' image.
For more examples, refer to the EXAMPLES section below.
POSITIONAL ARGUMENTS
-
- INSTANCE_NAME
-
Name of the instance to update.
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) or ro (read-only). Defaults to
rw. Fails if the disk mode is ro and volume mount mode is rw.
-
- --container-privileged
-
Sets permission to run container to the specified value.
- --container-restart-policy=POLICY
-
Sets container restart policy to the specified value. POLICY must be one
of: never, on-failure, always.
- --container-stdin
-
Sets configuration whether to keep container STDIN always 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, you may be prompted to select
a zone. gcloud will attempt to identify the zone by searching for
resources in your project. If the zone cannot be determined, you will then be
prompted with all Google Cloud Platform zones.
To avoid prompting when this flag is omitted, you can set the compute/zone property:
- $ 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 KEY with value VALUE passed to
container.
-
- ---
- Sets KEY to the specified value.
- ---
- Adds KEY = VALUE, if KEY is not yet declared.
- ---
- Only the last value of KEY is taken when KEY is repeated more
-
than once.
Values, declared with --container-env flag override those with the same
KEY from file, provided in --container-env-file.
-
- --container-env-file=CONTAINER_ENV_FILE
-
Update environment variables from a file. Same update rules as for
--container-env apply. Values, declared with --container-env
flag override those with the same KEY from 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
-
docker format).
-
- *
- If # is first non-whitespace character in a line the line is ignored
as a comment.
-
- --remove-container-env=[KEY,...]
-
Removes environment variables KEY from 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-path is not yet declared.
- ---
- Replaces a volume, if mount-path is declared.
-
All parameters (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) with mountPath: MOUNTPATH from container declaration.
Does nothing, if a volume mount is not declared.
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for 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 alpha 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 alpha compute instances update-container instance-1 \
--container-image=gcr.io/google-containers/busybox \
--container-privileged
NOTES
This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you will have to apply for early access and have your projects registered on the API whitelist to use it. To do so, contact Support at cloud.google.com/support These variants are also available:
- $ gcloud compute instances update-container $ gcloud beta compute instances update-container