zoukankan      html  css  js  c++  java
  • [Docker] Run Stateless Docker Containers (Volumes with docker compose)

    Docker containers should be designed to be stateless, meaning that they can survive system reboots and container terminations gracefully, and without the loss of data. Designing with stateless containers in mind will also help your app grow and make future horizontal scaling trivial.

    In this lesson, we will review an app that saves uploaded files to the filesystem. Then we will learn how to setup a persistent volume for the uploaded files so they can survive Docker container halts, restarts, stops and respawns.

    Dockerfile:

    FROM mhart/alpine-node
    WORKDIR /srv
    COPY . .
    RUN mkdir uploads
    RUN yarn
    EXPOSE 8080
    CMD node index.js

    docker-compose.yaml:

    version: '3'
    services:
      app:
        build: .
        ports:
          - "8080:8080"
        volumes:
          - appdata:/srv/uploads
    volumes:
      appdata:

    Remove docker compose:

    docker-compose rm -f
     
  • 相关阅读:
    jq元素拖拽
    路径中取文件名
    HBase相关问题
    HBase数据模型
    HBase安装过程
    HBase物理模型
    Hadoop性能调优
    Hive性能调优
    Hadoop资源调度器
    Hive的执行生命周期
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14367490.html
Copyright © 2011-2022 走看看