sundayku
sundayku

Reputation: 182

Fail to set ulimit inside docker container

I have committed a ubuntu image with a new user call "user" and then i create the container with the following command

 sudo docker run -u=user -ti test1 /bin/bash

I check that there are only two process running

user@1bc12c468f29:/$ ps
  PID TTY          TIME CMD
   1 ?        00:00:00 bash
   12 ?        00:00:00 ps

But after i set

ulimit -u 10

I cannot create any new process, even ls

user@1bc12c468f29:/$ ulimit -u 10
user@1bc12c468f29:/$ ls
bash: fork: retry: No child processes
bash: fork: retry: No child processes
bash: fork: retry: No child processes
bash: fork: retry: No child processes
bash: fork: Resource temporarily unavailable

Should ulimit -u 10 allow 10 processes running simultaneously?

Upvotes: 3

Views: 2258

Answers (1)

cipher
cipher

Reputation: 59

output of ps doesn't give list of all running processes. It only gives list of processes running in your TTY. To get list of all running processes you can run: ps -ef. To get total number: ps -ef|wc -l

Upvotes: 1

Related Questions