xxxxxxxxxx
$ docker run -d -it \
--mount type=bind,source="$(pwd)"/file.txt,target=/file.txt,readonly \
alpine:latest
Copy
xxxxxxxxxx
services:
alpine:
image: alpine:latest
tty: true
volumes:
- type: bind
source: ./file.txt
target: file.txt
read_only: true
Copy
xxxxxxxxxx
services:
alpine:
image: alpine:latest
tty: true
volumes:
- ./file.txt:/file.txt:ro
Copy
xxxxxxxxxx
$ docker run -d -it
-v "$(pwd)"/file.txt:/file.txt:ro \
alpine:latest
Copy