Skip to content

Instantly share code, notes, and snippets.

@quangkeu95
Last active November 9, 2017 09:24
Show Gist options
  • Save quangkeu95/d9897aed224fb5b6306f4c5b9fb12a70 to your computer and use it in GitHub Desktop.
Save quangkeu95/d9897aed224fb5b6306f4c5b9fb12a70 to your computer and use it in GitHub Desktop.

Dockerfile VOLUME

Định nghĩa VOLUME trong Dockerfile sẽ:

  • Expose folder/directory được tạo bởi container ra đường dẫn trên host: /var/lib/docker/volumes/[container_id]/_data/ Note: _data được gọi là "mount point"

Run container với lệnh: docker run --rm image

Khi container được run, ta có thể check volume được tạo bởi container bằng câu lệnh: docker volume ls Khi container exited, volume sẽ mất do ta định nghĩa cờ --rm ở câu lệnh docker run, do đó container và volume của nó sẽ được remove hoàn toàn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment