Docker exec: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 30: Line 30:


As the current user:
As the current user:
docker exec -it <''container-id''> /bin/bash


As root:
As root:
docker exec -u 0 -it <''container-id''> /bin/bash

Revision as of 07:03, 26 November 2017

External

Internal

Overview

Attaches to a running container.

docker exec [-u <''uid''>] -it <running-cotainer-image-name> 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