Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new user to existing container #34

Closed
cthiebault opened this issue Mar 31, 2016 · 4 comments
Closed

Add new user to existing container #34

cthiebault opened this issue Mar 31, 2016 · 4 comments

Comments

@cthiebault
Copy link

Is there a way to add new user to /etc/sftp-users.confonce the container already exists?
It seems that users are created only at first run:
https://github.com/atmoz/sftp/blob/master/entrypoint#L87-L121

We could imagine that users are created on each container start:

  • if user does not exist, it creates & configure it
  • if user already exists, it does nothing
@atmoz
Copy link
Owner

atmoz commented Mar 31, 2016

In what scenario do you need to stop and start this container when you can simply recreate it (after updating sftp-users.conf)?

@cthiebault
Copy link
Author

When using this image with Docker Compose : if I add users to my config, I need to manually destroy the container... I can't do just docker-compose up -d.
But you are right, I should be able to recreate this container without loosing anything!

@cthiebault
Copy link
Author

In theory, you are right : Docker compose should recreates container when config changed (it does this for nginx for example).

I don't understand why docker compose does not recreate the container automatically when I add new users to sftp-users.conf.

Here is my docker-compose.yml:

version: '2'

services:

  sftp:    
    image: atmoz/sftp
    ports:
      - "2222:22"
    volumes:
      - ./sftp-users.conf:/etc/sftp-users.conf:ro
      - /srv/docker/sftp:/home

Using nginx image, docker compose recreates nginx container when I change config file... but it does not with sftp image :(

nginx:
  image: nginx
  volumes:
    - ./nginx/my-app.conf:/etc/nginx/conf.d/my-app.conf:ro    
    - ./nginx/htpasswd:/auth/htpasswd:ro

Any idea?

@atmoz
Copy link
Owner

atmoz commented Nov 29, 2016

docker-compose up -d --force-recreate should recreate containers. Specify your sftp container name, to only recreate that.

@atmoz atmoz closed this as completed Nov 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants