Reputation: 12462
For following docker run command,
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
I would like to run it via docker-compose up
Here is 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:
I am getting the following error when i run 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
How can I resolve it?
Upvotes: 2
Views: 5327
Reputation: 3691
You're using docker-compose file version 3, and you need version 3.6 if you want to use -type: tmpfs
specifying target.
Just try replacing version: "3"
by version: "3.6"
More information in: Docker compose info to use tmpfs
Upvotes: 5