Docker exec

From NovaOrdis Knowledge Base
Revision as of 23:39, 24 January 2018 by Ovidiu (talk | contribs) (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Overview

Attaches to a running container. This command can run new process in already running container (container must a have PID 1 process running already).

docker exec [-u <uid>] -it <running-container-name-or-ID> bash

Options

-i

Interactive.

-t

Allocated pseudo-TTY

Scenarios

Attach to a Running Container

As the current user:

docker exec -it <container-id> /bin/bash

As root:

docker exec -u 0 -it <container-id> /bin/bash