对于以下泊坞窗运行命令,
docker run --rm -itd --privileged --cap-add=SYS_PTRACE --cap-add=SYS_ADMIN -v /dev/shm --tmpfs /dev/shm:rw,nosuid,nodev,exec centos:7
我想通过docker-compose up
这是docker-compose.yml
version: "3"
services:
centos-testing:
image: centos:7
privileged: true
tty: true
stdin_open: true
ulimits:
nproc: 655353
nofile:
soft: 20000
hard: 40000
cap_add:
- SYS_PTRACE
- SYS_ADMIN
volumes:
- type: tmpfs
source: /dev/shm
target: /dev/shm:rw,nosuid,nodev,exec
networks:
- testnet
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: "2"
memory: 50M
restart_policy:
condition: on-failure
networks:
testnet:
运行docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.centos-testing.volumes contains an invalid type, it should be a string
我该如何解决?
答案 0 :(得分:1)
您正在使用docker-compose文件版本3,如果您想使用-type: tmpfs
指定目标,则需要3.6版。
尝试将version: "3"
替换为version: "3.6"