Exec into a Container as Root without Sudo or a Password

Опубликовано: 06 Октябрь 2024
на канале: Nick Janetakis
3,515
41

This is handy when your Dockerfile sets a non-root user and you need to quickly debug something.

Hit the subscribe button to receive more videos like this!

REFERENCE LINKS
---------------------------------------------------
► https://github.com/nickjj/docker-flas...

COURSES
---------------------------------------------------
Courses I've created that focus on web dev and deployment topics.

► https://nickjanetakis.com/courses/

THE TOOLS I USE / GEAR
---------------------------------------------------
► https://nickjanetakis.com/blog/the-to...

FOLLOW ME ELSEWHERE
---------------------------------------------------
► Twitter:   / nickjanetakis  
► GitHub: https://github.com/nickjj

TIMESTAMPS
---------------------------------------------------
0:00 -- Intro
0:18 -- When you might want to do this
0:56 -- Connecting as a non-root user with Docker Compose
1:47 -- Connecting as the root user with the --user flag
2:23 -- Connecting as both users at once
3:51 -- Technically you can use id 0 instead of referencing root too
4:32 -- My projects come with a shortcut to get into a bash prompt
4:47 -- Exec'ing in as the root user works with regular Docker too