3
  1. I installed Ubuntu in a docker container
 docker run -it --privileged -u root --name ubuntu-vm ubuntu /bin/bash 

  1. Installed docker in Ubuntu according to the official instructions

https://docs.docker.com/engine/install/ubuntu/

  1. Next command
sudo service docker start

starts docker, but i got message

root@41f5384a6b58:/# sudo service docker start
mount: /sys/fs/cgroup/cpuset: permission denied.
mount: /sys/fs/cgroup/cpu: permission denied.
mount: /sys/fs/cgroup/cpuacct: permission denied.
mount: /sys/fs/cgroup/blkio: permission denied.
mount: /sys/fs/cgroup/memory: permission denied.
mount: /sys/fs/cgroup/devices: permission denied.
mount: /sys/fs/cgroup/freezer: permission denied.
mount: /sys/fs/cgroup/net_cls: permission denied.
mount: /sys/fs/cgroup/perf_event: permission denied.
mount: /sys/fs/cgroup/net_prio: permission denied.
mount: /sys/fs/cgroup/hugetlb: permission denied.
mount: /sys/fs/cgroup/pids: permission denied.
mount: /sys/fs/cgroup/rdma: permission denied.
 * Starting Docker: docker 
  1. After that i try to run docker compose up.

The build starts, but it looks like the build is taking forever. I can watch the size of the Ubuntu container grow, reach 59GB (allocated maximum), and of course I get an out-of-memory error (or similar). My docker compose should be around 1GB (not 59 or more).

It seems that the docker is not started by the root user, but by some other one, because the command сd sys/fs/cgroup/cpuset (сd sys/fs/cgroup/...) or for another similar directory works.

command

sudo usermod -aG docker root

did not solve the problem

How can I solve the problem from point 3?

I am trying to use Ubuntu in a container, so that it is convenient and quick to determine the resources (memory, ram etc.) required for my server to work.

tabool
  • 89
  • 9
  • 1
    There are a lot of known problems in case of running Docker-in-Docker. Read this article https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/. If you want it anyway, see the solution with docker.sock as a volume https://stackoverflow.com/q/70872355/3034558 – czende Feb 28 '23 at 14:16
  • You also might consider using a virtual machine, especially if you do want a fixed-size memory allocation for your combined containers. This doesn't especially seem like a programming-related question, though, and somewhere like [unix.se] might be a better place to ask about installing Docker. – David Maze Feb 28 '23 at 14:22

0 Answers0