Not certain how you are starting the ecs-agent. Ran into the error of
Disabling TaskCPUMemLimit because agent is unabled to setup '/ecs cgroup: cgroup create: unable to create controller: /sys/fs/cgroup/systemd/ecs: read-only file system
We resolved this by adding the volume --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro
to the systemd unit file that we having launching ecs.
Outside of that, I assume the issue resides with the ecsInstanceRole
. Can you verify it has the following permissions? AmazonEC2ContainerRegistryFullAccess
, AmazonEC2ContainerServiceFullAccess
, AmazonEC2ContainerServiceforEC2Role
Below is the full systemd file for ecs-agent.
[Unit]
Description=Docker Container %I
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStartPre=-/usr/bin/docker rm -f %i
ExecStart=/usr/bin/docker run --name %i
--restart=on-failure:10
--volume=/var/run:/var/run
--volume=/var/log/ecs/:/log:Z
--volume=/var/lib/ecs/data:/data:Z
--volume=/etc/ecs:/etc/ecs
--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro
--net=host
--env-file=/etc/ecs/ecs.config
--env LOGSPOUT=ignore
amazon/amazon-ecs-agent:latest
ExecStop=/usr/bin/docker stop %i
[Install]
WantedBy=default.target
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…