Skip to content

How to run a container? #2328

Answered by adamkpickering
Luxvao asked this question in Q&A
Jun 3, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

The only way I'm aware of doing this is to run your container in daemon mode, i.e.

nerdctl run -d --name maindebian debian /bin/sleep inf

You can then get a shell in your container with

nerdctl exec -it maindebian /bin/sh

The /bin/sleep inf is there because the container needs to have some active process, otherwise it just exits. A better thing to run would probably be the system init, though I'm not sure how that would work out with this image. I used to do this successfully with an alpine image - see https://github.com/adamkpickering/alpine-dev for my setup.

Also note you can then nerdctl start and nerdctl stop the running container. And you can install any dependencies you want in th…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Luxvao
Comment options

@Luxvao
Comment options

@adamkpickering
Comment options

Answer selected by Luxvao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants