使用docker -v选项我们可以指定写访问权,如下所示
docker run -d --name web -v /etc/localtime:/etc/localtime:ro
其中ro
表示只读访问。
我们怎样才能用无花果做到这一点?如果
pg:
image: xxxxxxxxxxxxxx/postgres:9.1-1
web:
image: xxxxxxxxxxxxxx/unicorn:0.0.2
volumes:
- /etc/localtime:/etc/localtime:ro
- .:/src
links:
- pg:server_pg
command: /bin/bash -xe something.sh
在上面的示例:ro 中,卷部分会引发以下错误
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 39, in main
File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch
File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch
File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch
File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command
File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command
File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 306, in up
File "/code/build/fig/out00-PYZ.pyz/fig.project", line 131, in up
File "/code/build/fig/out00-PYZ.pyz/fig.service", line 173, in recreate_containers
File "/code/build/fig/out00-PYZ.pyz/fig.service", line 195, in recreate_container
File "/code/build/fig/out00-PYZ.pyz/fig.service", line 225, in start_container
ValueError: too many values to unpack