Running containers for a bash session

Let's say you want a bash session in a brand new Centos 8 container. You can have that by running a detached container running in the background:

docker run -d -t --name centos centos:8

And then, by exec-ing bash in it:

docker exec -it centos bash

This works with most linux distro images like ubuntu, debian, fedora, alpine, etc.

If the container doesn't have a long running task set as the entrypoint, you can always override it using --entrypoint.

Subscribe to Galdin Raphael

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe