Error response from daemon: driver failed programming external connectivity on endpoint nifty_knuth

$ docker run -p 9999:873 -v /var/tmp/jy003s66t:/data -e USERNAME=admin -e PASSWORD=mysecret axiom/rsync-server
docker: Error response from daemon: driver failed programming external connectivity on endpoint nifty_knuth (9968cc89e7dc503637acf6c7e5a80311ec29268ec0664890e00f0a94a828e20d): Bind for 0.0.0.0:9999 failed: port is already allocated.

Why?

And anyway, more generally, how do you virtualize an rsync server?
Possibly with access via SSH key (without password).

I practically would like to use rsync (client) in this way

$ rsync -ai src localhost:/dest

nothing?
no ideas?

.

That’s why:

You can bind a host port more than once.

Strangely now the server is working

~$ docker run --detach -p 9999:873 -v /var/tmp/jy003s66t:/data -e USERNAME=admin -e PASSWORD=mysecret axiom/rsync-server
d1fc2e83c91bf1c1304dfafc56be5fe9fdf5f52096b5f96193d072d9a9b7583b

but the client is not working

~$ rsync -nav rsync:
ssh: Could not resolve hostname rsync: Temporary failure in name resolution
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(228) [Receiver=3.2.3]

Please, add more details what you expect and why. Your last rsync command does not even have a destination so it would just (as far as I know) list files on the source, but you used rsync: as a source as if you had rsync as a hostname.

So do you think it should work?

@rimelek Thanks for pointing out in a pm that my last response missed a very crucial “not”.

Should have been “You can not bind a host port more than once.”

I made some changes, but it still doesn’t work

+ docker run --detach -p 9999:873 -v /var/tmp/jy003s66t:/data -e USERNAME=admin -e PASSWORD=mysecret axiom/rsync-server
566be52f2a5b647d7750b4294da057a3798e6634c79a3c5373553f68b46d076d
+ rsync -nav --port 9999 . rsync://
rsync: getaddrinfo:  9999: Name or service not known
rsync error: error in socket IO (code 10) at clientserver.c(137) [sender=3.2.3]

Sorry, if you don’t answer our questions we can’t help.

Your command is obviously wrong if you don’t have a hostname called “rsync”.

OR when an rsync:// URL is specified (see also the lqUSING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTIONrq section for an exception to this latter rule).

Here are some experiments

+ docker run --detach -p 9999:873 -v /var/tmp/jy003s66t:/data -e USERNAME=admin -e PASSWORD=mysecret axiom/rsync-server
c292281faf52a9073c7af18e1fdc01f1ca7b143e3524649743e9f6bf5895b850
+ rsync -nav --port 9999 . rsync2://
ssh: Could not resolve hostname rsync2: Temporary failure in name resolution
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(228) [sender=3.2.3]

Obviously!!!

+ rsync -nav --port 9999 . rsync://
rsync: getaddrinfo:  9999: Name or service not known
rsync error: error in socket IO (code 10) at clientserver.c(137) [sender=3.2.3]
+ rsync -nav --port 9999 . rsync://localhost
volume         	/data directory
+ rsync -nav --port 9999 . rsync://localhost/data
@ERROR: Unknown module 'data'
rsync error: error starting client-server protocol (code 5) at main.c(1817) [sender=3.2.3]

???

I will attempt to explain why I asked for what you expected from your commands, because I think there is a misunderstanding. If you keep quating the same or almost the same wrong code and link the online manual of rsync I guess it means you don’t know what to expect. Without knowing what you want to achieve I can’t tell you what the solution is, but even if I tell you something that works, you will make the same mistake or similar mistakes later. I would like you to understand what you are using and why. When I have a problem at work and I feel I can’t solve it, I ask someone to listen to me while I explain step by step what I want to do, why I think it should work and what happens instead. Because I need to think it through to be able to explain it, I almost always realize my own mistakes. Sometimes I can’t figure out the answer right away, but I can figure out the right question.

now let’s quote some of your commands:

This is what you used in the original post, before @meyay answered your question containing a typo, but then he corrected it in n other post.

Then you started to ask a different question about rsync, which is not really related to Docker anymore. It is just using rsync on Linux. Not a big deal, if we can quickly answer that so when someone find this topic because of the title, they can see the answer and a little bonus. Although, since this is not related to Docker anymore, you should be even more specific in your question providing more details, since every one of us has a different level of understanding Linux and commands on Linux. We also need to read the documentation and find out your goal as well.

This is why I told you it was a hostname and it was not surprising that it did not work.

This is what you commented as “Obviously!!!”, but we still don’t know what your actual goal was. Yes, rsync2 is still a hostname which does not exist. Now you used two slashes after the colon and changed the hostname so it is more obvious that it will give you a domain name resolution error since that is not even mentioned in the documentation. I know you know that, I just point out the obvious.

Now you use rsync as hostname with the colon and two slashes. The question is what you expect from it. Let’s quote the beginning of the documentation

  Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
        rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

As yo can see the HOST and DEST is not optional, so again, it is not surprising that id did not work.

It looks like you want to sync your current directory (because you used one dot as source) to somewhere. Again, the question is where. You saw rsync:// in the documentation, I get that, but why do you expect it to work? There are examples in the documentation and none of them are like what you tried so far.

Now this contains the hostname but you did not use the hostname since your original post and you did not add any comment about why you tried any of the commands. You have an output, but no explanation whether it was an error message or it was a successful command’s status message. I did not try the command, but acccording to the documentation, DEST is not optional.

This last command contains /data at the end, but no explanation why you try that with “data”. We don’t know anything about the configuration of your rsync daemon, but data should be configured there. I used Google to search for rsync unknown module and this is what I found

I recommend you to learn about rsync by reading the documentation more carefully, searching for error messages and finding examples. In 2022 there is a good chance that you can find even videos on YouTube about rsync or almost anything.

After that if you still don’t understand why rsync does not work, stackexchange could be a better place to ask about general commands on Linux. Of course, if you think the issue must be related to Docker, feel free to ask here, but also explaine why you think the question is related to Docker.

+ docker run \
    --detach -p 9999:873 \
    -v /tmp/rsync-data.3666756:/data \
    -v "$(readlink -e rsyncd.conf)":/etc/rsyncd.conf \
    -e USERNAME=admin -e PASSWORD=mysecret \
    axiom/rsync-server
d53a38cca43c7753339fc2ce1515714164d6e50d169109e7acd3779f7a857f5b
+ sleep 3
+ cat rsyncd.conf
[data]
path = /data
auth users = admin
hosts allow = *
list = false 
+ rsync --port 9999 -nav . rsync://admin@localhost/data
Password: 
@ERROR: auth failed on module data
rsync error: error starting client-server protocol (code 5) at main.c(1817) [sender=3.2.3]
rsync -nav . rsync://admin@localhost:9999/data