Your kernel does not support swap limit capabilities or the cgroup is not mounted, How to set this on the ubuntu container

Expected behavior

Expected behavior – the nextflow runs successfully.

Actual behavior

Nexflow script break with the following error:

Command error:
  WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
  /bin/bash: .command.run: No such file or directory

Work dir:
  /root/work/77/6e871d3335afc6cb42ab5502050b8c

Tip: view the complete command output by changing to the process work dir and entering the command `cat .command.out`

Additional Information

To provide a background. I am working on building a docker image that contains all by required scripts to run the pipeline flow, within which nexflow script as well docker would run.

docker run -v /var/run/docker.sock:/var/run/docker.sock --memory=5000m --memory-swappiness=100 -it <MyIMAGE> /bin/bash

Once, I log into the container using the image, I run a bash script which is a wrapper. This would call scripts, as well as itself, would download files from the AWS S3 as one of its functionality.

Within this, I am calling a nextflow script that performs the pipeline execution part (also uses docker internally). However, the first step contains the calling of function that verifies the input csv file, at that point itself there is the above error seen.

Also, the .command.run file is present in the working dir when manually verified.

It would be great if someone could help me with it.

Thanks in advance.