跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Docker] 问一个 docker 数据卷和宿主机目录挂载相关的问题

发表于

测试环境用下面这个 docker-compose.yml 即可

services:
  ubuntu:
    image: ubuntu:22.04
    volumes:
      # - volumeetc:/etc
      - ./data/etc:/etc
    command: tail -f /dev/null

volumes:
  volumeetc:

我的问题是:

如果使用 数据卷 volumeetc 挂载到 容器 /etc 目录, 启动容器后, 这个数据卷里的数据是完整的 etc 目录内的数据;

如果使用宿主机目录比如 ./data/etc 挂载到容器内, 宿主机 ./data/etc 这个目录下的数据不完整, 只有 hostname, hosts, resolv.conf 这三个文件;

我在 linux, mac, windows 都测试过, 都是这个行为;

调整过宿主机目录相关权限, 尽量和容器内保持一致, 也不行

我的问题是 为什么会有这种差异?

我个人推测跟容器创建的初始化流程有关, 但是没找到什么文档

希望大佬指条路

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.