2015-01-22 11:47:32 -05:00
% ATOMIC(1) Atomic Man Pages
% Dan Walsh
% January 2015
# NAME
2015-01-23 04:48:36 -05:00
atomic-run - Execute container image run method
2015-01-22 11:47:32 -05:00
# SYNOPSIS
**atomic run**
2015-08-26 07:22:08 -04:00
[**-h**|**--help**]
2015-07-14 17:04:40 -04:00
[**--display**]
2015-08-30 09:57:04 -04:00
[**-n**][**--name**[=*NAME*]]
2017-05-30 10:31:47 -05:00
[**-r**, * * --replace**]
2015-02-23 17:31:28 -05:00
[**--spc**]
2017-02-02 10:51:46 -06:00
[**--storage**]
2018-02-15 09:51:42 +01:00
[**--set**=*NAME*=*VALUE*]
2016-01-11 14:26:09 -06:00
[**--quiet**]
2015-01-22 11:47:32 -05:00
IMAGE [COMMAND] [ARG...]
# DESCRIPTION
2016-09-21 20:52:43 +00:00
**atomic run** attempts to start an existing container or run a container
from an image, first reading the `LABEL RUN` field in the container IMAGE.
2015-01-23 04:48:36 -05:00
2015-02-23 17:31:28 -05:00
If the container image has a LABEL RUN instruction like the following:
2015-01-23 04:48:36 -05:00
2015-08-26 07:22:08 -04:00
`LABEL RUN /usr/bin/docker run -t -i --rm \${OPT1} --cap-add=SYS_ADMIN --net=host -v \${LOGDIR}:/var/log -v \${DATADIR}:/var/lib --name \${NAME} \${IMAGE} \${OPT2} run.sh \${OPT3}`
`atomic run` will run the following:
`/usr/bin/docker run -t -i --rm --cap-add=SYS_ADMIN --net=host -v ${LOGDIR}:/var/log -v ${DATADIR}:/var/lib --name ${NAME} ${IMAGE} run.sh`
2015-01-23 04:48:36 -05:00
2015-03-31 16:32:13 -04:00
If this field does not exist, `atomic run` defaults to the following:
2015-08-26 07:22:08 -04:00
`/usr/bin/docker run -t -i --rm -v ${LOGDIR}:/var/log -v ${DATADIR}:/var/lib --name ${NAME} ${IMAGE}`
2015-01-22 11:47:32 -05:00
These defaults are suggested values for your container images.
2015-06-18 12:58:22 +02:00
`atomic run` will set the following environment variables for use in the command:
**NAME**
The name specified via the command. NAME will be replaced with IMAGE if it is not specified.
**IMAGE**
The name and image specified via the command.
2015-06-17 00:56:36 +05:30
**OPT1, OPT2, OPT3**
Additional options which can be specified via the command.
2015-06-18 12:58:22 +02:00
**SUDO_UID**
The `SUDO_UID` environment variable. This is useful with the docker `-u` option for user space tools. If the environment variable is not available, the value of `/proc/self/loginuid` is used.
**SUDO_GID**
The `SUDO_GID` environment variable. This is useful with the docker `-u` option for user space tools. If the environment variable is not available, the default GID of the value for `SUDO_UID` is used. If this value is not available, the value of `/proc/self/loginuid` is used.
2015-01-22 11:47:32 -05:00
2016-08-18 10:34:08 +02:00
**RUN_OPTS**
Content of file specified by `LABEL RUN_OPTS_FILE` . During `atomic install` , the `install.sh` can populate the file with any additional options that need to be passed to `docker run` , for example `--hostname=www.example.test` or `--net host` . The file name undergoes environment variable expansion, so for example `LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'` can be used to store per-container configuration.
2017-07-20 18:04:30 +02:00
Custom environment variables can be provided to the container through the LABEL RUN instruction as follows:
`LABEL RUN /usr/bin/docker run -t -i --rm -e FOO="\${FOO:-bar}" -v \${LOGDIR}:/var/log -v \${DATADIR}:/var/lib --name \${NAME} \${IMAGE}`
`atomic run` will run the following:
`/usr/bin/docker run -t -i --rm -e FOO="${FOO:-bar}" -v ${LOGDIR}:/var/log -v ${DATADIR}:/var/lib --name ${NAME} ${IMAGE}`
The value of `FOO` can be set explicitly via `FOO=baz atomic run` .
2015-01-22 11:47:32 -05:00
# OPTIONS:
2015-08-26 07:22:08 -04:00
**-h** * * --help**
2015-01-22 11:47:32 -05:00
Print usage statement
2015-07-14 17:04:40 -04:00
**--display**
Display the image's run options and environment variables populated into the run command.
The run command will not execute if --display is specified.
If --display is not specified the run command will execute.
2015-08-30 09:57:04 -04:00
**--n** * * --name**=""
2015-01-22 11:47:32 -05:00
Use this name for creating run content for the container.
NAME will default to the IMAGENAME if it is not specified.
2017-05-30 10:31:47 -05:00
**-r** * * --replace**
Replaces an existing container by the same name if it exists prior to running.
2018-02-22 22:44:23 +01:00
**--runtime=PATH**
Change the OCI runtime used by the systemd service file for running
system containers and user containers. If runtime is not defined, the
value **runtime ** in the configuration file is used for system
containers. If there is no runtime defined in the configuration file
2018-04-15 12:07:07 +02:00
as well, then the default * * /usr/bin/runc** is used.
2017-05-30 10:31:47 -05:00
2015-01-22 11:47:32 -05:00
**--spc**
2015-08-26 07:22:08 -04:00
Run container in super privileged container mode. The image will run with the following command:
2015-01-22 11:47:32 -05:00
2015-08-26 07:22:08 -04:00
`/usr/bin/docker run -t -i --rm --privileged -v /:/host -v /run:/run --net=host --ipc=host --pid=host -e HOST=/host -e NAME=${NAME} -e IMAGE=${IMAGE} --name ${NAME} ${IMAGE}`
2015-01-22 11:47:32 -05:00
2018-02-15 09:51:42 +01:00
**--storage**
2017-02-02 10:51:46 -06:00
Allows you to override the default definition for the storage backend where your image will reside if pulled. If the image is already local,
the --storage option will dictate where atomic should look for the image prior to running. Valid options are `docker` and `ostree` .
2018-02-15 09:51:42 +01:00
**--set=NAME=VALUE**
Set a value that is going to be used by a system container for its
configuration and can be specified multiple times. It is used only
by --system. OSTree is required for this feature to be available.
2017-02-02 10:51:46 -06:00
2016-01-11 14:26:09 -06:00
**--quiet**
Run without verbose messaging (i.e. security warnings).
2015-01-22 11:47:32 -05:00
# HISTORY
January 2015, Originally compiled by Daniel Walsh (dwalsh at redhat dot com)
2015-07-14 17:04:40 -04:00
July 2015, edited by Sally O'Malley (somalley at redhat dot com)