[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [atomic-devel] [atomic] Revisiting the defaults for `atomic run` with and without --spc #75



adding atomic-devel

On 06/26/2015 02:39 PM, Brian (bex) Exelbierd wrote:
I've opened issue #75: https://github.com/projectatomic/atomic/issues/75

The current default behavior is inconsistent for SPC and non-SPC
invocations (see below).

In short, the default for `atomic run --spc` drops you into an
interactive session.  The default for `atomic run` is to create a
running container that can later be used for commands.

PR #74 fixes this behavior.

However, I'd like us to rethink this.  I believe a better solution would
be something like this:

`atomic run [--spc] image [command]`:
     if (CREATE LABEL present)
       execute CREATE label passing command if present in an environment
variable
     if (RUN LABEL present)
       execute RUN LABEL passing command if present in an environment
variable
     else
         use `docker create` to launch the container and then `docker
exec` with /bin/bash or command if present

`atomic start [--spc] image [command]`:
     if (CREATE LABEL present)
       execute CREATE label passing command if present in an environment
variable
     else
         use `docker create` to launch the container passing command if
present


--------------------------------------------------------------------------------

Example of current behavior
--------------------------------------------------------------------------------

# ./atomic run --spc busybox /bin/ps
Container 'busybox-spc' must be running before executing a command into it.
Execute the following to create the container:
./atomic run --spc --name busybox-spc busybox
# ./atomic run --spc busybox
/usr/bin/docker run -t -i --rm --privileged -v /:/host -v /run:/run -v
/etc/localtime:/etc/localtime --net=host --ipc=host --pid=host -e
HOST=/host -e NAME=${NAME} -e IMAGE=${IMAGE} ${IMAGE} /bin/sh
<interactive shell>
--------------------------------------------------------------------------------

# ./atomic run busybox /bin/ps
Container 'busybox' must be running before executing a command into it.
Execute the following to create the container:
./atomic run busybox
# ./atomic run busybox
/usr/bin/docker create -t -i --name ${NAME} ${IMAGE} /bin/sh
busybox
# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED
         STATUS              PORTS               NAMES
e7f88fef782d        busybox:latest      "/bin/sh"           5 seconds
ago       Up 4 seconds                            busybox

regards,

bex


--
Brian (bex) Exelbierd
Associate Software Engineer
Open Source and Standards
Red Hat, Inc., Brno, Czech Republic
P: +420 606 055 877 (CZ) | E: bexelbie redhat com (preferred)
IRC: bexelbie | IM: Google: bcexelbi gmail com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]