How to install and run Docker in AL2023

0

I have a locally running AL2023 container to which I want to install Docker. I've run yum install -y docker and got it installed but running dockerd gives the following output below. whoami shows root

INFO[2023-07-09T13:23:42.879644071Z] Starting up
INFO[2023-07-09T13:23:42.880840787Z] libcontainerd: started new containerd process  pid=509
INFO[2023-07-09T13:23:42.880895981Z] parsed scheme: "unix"                         module=grpc
INFO[2023-07-09T13:23:42.880905948Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-07-09T13:23:42.880953506Z] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2023-07-09T13:23:42.880990601Z] ClientConn switching balancer to "pick_first"  module=grpc
WARN[0000] containerd config version `1` has been deprecated and will be removed in containerd v2.0, please switch to version `2`, see https://github.com/containerd/containerd/blob/main/docs/PLUGINS.md#version-header
INFO[2023-07-09T13:23:42.893985172Z] starting containerd                           revision=1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f version=1.6.19
INFO[2023-07-09T13:23:42.900612647Z] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2023-07-09T13:23:42.900656020Z] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
INFO[2023-07-09T13:23:42.900718201Z] skip loading plugin "io.containerd.snapshotter.v1.aufs"...  error="aufs is not supported (modprobe aufs failed: exec: \"modprobe\": executable file not found in $PATH \"\"): skip plugin" type=io.containerd.snapshotter.v1
INFO[2023-07-09T13:23:42.900733153Z] loading plugin "io.containerd.snapshotter.v1.devmapper"...  type=io.containerd.snapshotter.v1
WARN[2023-07-09T13:23:42.900747675Z] failed to load plugin io.containerd.snapshotter.v1.devmapper  error="devmapper not configured"
INFO[2023-07-09T13:23:42.900758396Z] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2023-07-09T13:23:42.900767771Z] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2023-07-09T13:23:42.900812632Z] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
INFO[2023-07-09T13:23:42.900927285Z] skip loading plugin "io.containerd.snapshotter.v1.zfs"...  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1
INFO[2023-07-09T13:23:42.900943237Z] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[2023-07-09T13:23:42.900955193Z] could not use snapshotter devmapper in metadata plugin  error="devmapper not configured"
INFO[2023-07-09T13:23:42.900966789Z] metadata content store policy set             policy=shared
INFO[2023-07-09T13:23:42.901008240Z] loading plugin "io.containerd.differ.v1.walking"...  type=io.containerd.differ.v1
INFO[2023-07-09T13:23:42.901023519Z] loading plugin "io.containerd.event.v1.exchange"...  type=io.containerd.event.v1
INFO[2023-07-09T13:23:42.901032262Z] loading plugin "io.containerd.gc.v1.scheduler"...  type=io.containerd.gc.v1
INFO[2023-07-09T13:23:42.901053770Z] loading plugin "io.containerd.service.v1.introspection-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901061132Z] loading plugin "io.containerd.service.v1.containers-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901074023Z] loading plugin "io.containerd.service.v1.content-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901078703Z] loading plugin "io.containerd.service.v1.diff-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901084020Z] loading plugin "io.containerd.service.v1.images-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901098899Z] loading plugin "io.containerd.service.v1.leases-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901104055Z] loading plugin "io.containerd.service.v1.namespaces-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901109169Z] loading plugin "io.containerd.service.v1.snapshots-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901113496Z] loading plugin "io.containerd.runtime.v1.linux"...  type=io.containerd.runtime.v1
INFO[2023-07-09T13:23:42.901141382Z] loading plugin "io.containerd.runtime.v2.task"...  type=io.containerd.runtime.v2
INFO[2023-07-09T13:23:42.901177246Z] loading plugin "io.containerd.monitor.v1.cgroups"...  type=io.containerd.monitor.v1
INFO[2023-07-09T13:23:42.901336813Z] loading plugin "io.containerd.service.v1.tasks-service"...  type=io.containerd.service.v1
INFO[2023-07-09T13:23:42.901348557Z] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901353491Z] loading plugin "io.containerd.internal.v1.restart"...  type=io.containerd.internal.v1
INFO[2023-07-09T13:23:42.901370024Z] loading plugin "io.containerd.grpc.v1.containers"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901374528Z] loading plugin "io.containerd.grpc.v1.content"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901378673Z] loading plugin "io.containerd.grpc.v1.diff"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901382806Z] loading plugin "io.containerd.grpc.v1.events"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901401385Z] loading plugin "io.containerd.grpc.v1.healthcheck"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901411003Z] loading plugin "io.containerd.grpc.v1.images"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901415932Z] loading plugin "io.containerd.grpc.v1.leases"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901429921Z] loading plugin "io.containerd.grpc.v1.namespaces"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901435862Z] loading plugin "io.containerd.internal.v1.opt"...  type=io.containerd.internal.v1
INFO[2023-07-09T13:23:42.901458129Z] loading plugin "io.containerd.grpc.v1.snapshots"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901476758Z] loading plugin "io.containerd.grpc.v1.tasks"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901489694Z] loading plugin "io.containerd.grpc.v1.version"...  type=io.containerd.grpc.v1
INFO[2023-07-09T13:23:42.901493969Z] loading plugin "io.containerd.tracing.processor.v1.otlp"...  type=io.containerd.tracing.processor.v1
INFO[2023-07-09T13:23:42.901502055Z] skip loading plugin "io.containerd.tracing.processor.v1.otlp"...  error="no OpenTelemetry endpoint: skip plugin" type=io.containerd.tracing.processor.v1
INFO[2023-07-09T13:23:42.901513680Z] loading plugin "io.containerd.internal.v1.tracing"...  type=io.containerd.internal.v1
ERRO[2023-07-09T13:23:42.901534383Z] failed to initialize a tracing processor "otlp"  error="no OpenTelemetry endpoint: skip plugin"
INFO[2023-07-09T13:23:42.901687592Z] serving...                                    address=/var/run/docker/containerd/containerd-debug.sock
INFO[2023-07-09T13:23:42.901733143Z] serving...                                    address=/var/run/docker/containerd/containerd.sock.ttrpc
INFO[2023-07-09T13:23:42.901760356Z] serving...                                    address=/var/run/docker/containerd/containerd.sock
INFO[2023-07-09T13:23:42.901765897Z] containerd successfully booted in 0.008305s
INFO[2023-07-09T13:23:42.913995360Z] parsed scheme: "unix"                         module=grpc
INFO[2023-07-09T13:23:42.914016470Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-07-09T13:23:42.914031931Z] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2023-07-09T13:23:42.914042286Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2023-07-09T13:23:42.914817329Z] parsed scheme: "unix"                         module=grpc
INFO[2023-07-09T13:23:42.914833943Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-07-09T13:23:42.914841159Z] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2023-07-09T13:23:42.914843975Z] ClientConn switching balancer to "pick_first"  module=grpc
ERRO[2023-07-09T13:23:42.915878874Z] Failed to built-in GetDriver graph btrfs /var/lib/docker
ERRO[2023-07-09T13:23:42.916520982Z] failed to mount overlay: operation not permitted  storage-driver=overlay2
ERRO[2023-07-09T13:23:42.916711814Z] exec: "fuse-overlayfs": executable file not found in $PATH  storage-driver=fuse-overlayfs
ERRO[2023-07-09T13:23:42.916725154Z] Failed to built-in GetDriver graph aufs /var/lib/docker
ERRO[2023-07-09T13:23:42.917021505Z] failed to mount overlay: operation not permitted  storage-driver=overlay
WARN[2023-07-09T13:23:42.917176681Z] Unable to setup quota: operation not permitted
WARN[2023-07-09T13:23:42.925283232Z] Your kernel does not support cgroup blkio weight
WARN[2023-07-09T13:23:42.925296259Z] Your kernel does not support cgroup blkio weight_device
WARN[2023-07-09T13:23:42.925298480Z] Your kernel does not support cgroup blkio throttle.read_bps_device
WARN[2023-07-09T13:23:42.925306961Z] Your kernel does not support cgroup blkio throttle.write_bps_device
WARN[2023-07-09T13:23:42.925309218Z] Your kernel does not support cgroup blkio throttle.read_iops_device
WARN[2023-07-09T13:23:42.925318059Z] Your kernel does not support cgroup blkio throttle.write_iops_device
INFO[2023-07-09T13:23:42.925395997Z] Loading containers: start.
INFO[2023-07-09T13:23:42.926440298Z] unable to detect if iptables supports xlock: 'iptables --wait -L -n': `iptables v1.8.8 (nf_tables): Could not fetch rule set generation id: Permission denied (you must be root)`  error="exit status 4"
INFO[2023-07-09T13:23:42.937898166Z] stopping event stream following graceful shutdown  error="<nil>" module=libcontainerd namespace=moby
INFO[2023-07-09T13:23:42.937980152Z] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
INFO[2023-07-09T13:23:42.938016255Z] stopping healthcheck following graceful shutdown  module=libcontainerd
WARN[2023-07-09T13:23:43.938674736Z] grpc: addrConn.createTransport failed to connect to {unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}. Err :connection error: desc = "transport: Error while dialing dial unix:///var/run/docker/containerd/containerd.sock: timeout". Reconnecting...  module=grpc
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.8 (nf_tables): Could not fetch rule set generation id: Permission denied (you must be root)

 (exit status 4)
asked 10 months ago1170 views
2 Answers
1
Accepted Answer

I got around this by running the container in privileged mode: https://github.com/aws/aws-codebuild-docker-images/issues/164#issuecomment-460324202

answered 9 months ago
1

Hi, you may want to follow this very detailled doc to install docker with all required steps on AL2023:

https://linux.how2shout.com/how-to-install-docker-on-amazon-linux-2023/

How it helps!

Didier

profile pictureAWS
EXPERT
answered 10 months ago
profile picture
EXPERT
reviewed 10 months ago
  • I've tried variations of the same article and I've found sudo isn't installed by default and even when it is it makes no difference in running the commands. The other is systemctl throws an error.

    System has not been booted with systemd as init system (PID 1). Can't operate.
    Failed to connect to bus: Host is down
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions