Docker启动容器报错OCI-Runtime-Create

Administrator 51 2024-02-28

## 1、报错信息

1.1、启动容器报错:

```

Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\"": unknown

```

1.2、php容器内编译报错

```

0.306 runc run failed: unable to start container process: can't get final child's PID from pipe: EOF

```

## 2、问题分析可能是服务器交换大小不够,附上解决方案

### 方式1、

```shell

$ sysctl -n kernel.pid_max

32768

$ sysctl -w kernel.pid_max=100000

```

### 方式2、

```shell

$ sysctl -n user.max_user_namespaces

0

# if zero try this

$ sysctl -w user.max_user_namespaces=15000

```

### 方式3、

```shell

$ grep -w 'runc:\[1:CHILD\]: page allocation failure' /var/log/messages | tail -n 4

Nov 20 16:13:54 ETL010080 kernel: runc:[1:CHILD]: page allocation failure: order:4, mode:0x10c0d0

Nov 20 16:15:46 ETL010080 kernel: runc:[1:CHILD]: page allocation failure: order:4, mode:0x10c0d0

Nov 20 16:16:28 ETL010080 kernel: runc:[1:CHILD]: page allocation failure: order:4, mode:0x10c0d0

Nov 20 16:16:41 ETL010080 kernel: runc:[1:CHILD]: page allocation failure: order:4, mode:0x10c0d0

解决方案1

echo 3 >/proc/sys/vm/drop_caches

解决方案2

echo 1 >/proc/sys/vm/compact_memory

# or

sysctl -w vm.compact_memory=1

```