Home > Enterprise >  How to (su) switch user on amazonlinux docker image? [closed]
How to (su) switch user on amazonlinux docker image? [closed]

Time:09-17

I am trying to secure amazonlinux docker image.

I know I can use docker USER command.

But the thing is when developing I would like to login to image and su switch user in order to try out how image will work but there is no su command in amazonlinux.

How to logon to docker image and change user using bash commands ?

CodePudding user response:

One option is to attach directly to the container at run-time or when it's already running as root or another user with:

docker run -it -u root IMAGENAME bin/bash

or when already running:

docker exec -it -u root CONTAINERNAME bin/bash
  • Related