How to presist data in even if the docker conatiner is exit [closed]

When I docker down the container the data delete from the container and didn’t show up. I want when i do docker-compose down the up the data must be presist.

Here is my docker-compose file:

version: '3'

services:
 sftp:
  image: atmoz/sftp
  environment:
   - USERS_FILE=/etc/sftp/users.conf
  volumes:
   - ./user1-data:/home/user1
   - ./user2-data:/home/user2
   - ./users.conf:/etc/sftp/users.conf
  ports:
   - "2222:22"
  restart: unless-stopped

users.conf

new:pass:1001:1001:/home/user1-data:/bin/sh
new1:passd:1002:1002:/home/user2-data:/bin/sh

I tried to bind mout the volume but it didn’t works

I need to presist the data in the container even if deleted or down. I am using Winscp to login as users and check the presistance and connection of sftp.

Leave a Comment