Cannot assign address inside a Docker container
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
I want to use the rsub package for Sublime Text, in order to edit code inside a Docker container which runs on a remote server. However when I execute
rsub my_code.py
I get the error:
/usr/local/bin/rsub: connect: Cannot assign requested address
/usr/local/bin/rsub: line 392: /dev/tcp/localhost/52698: Cannot assign requested address
Line 392 basically corresponds to this instruction:
exec 3<> "/dev/tcp/localhost/52698"
bash: connect: Cannot assign requested address
bash: /dev/tcp/localhost/52698: Cannot assign requested address
If I exit the Docker container and run the same instruction on the remote server, it works nicely (or at least it doesn't give me any error messages). Can you help me fix this problem? I can modify the Dockerfile if needed. I can also post it here if you think it's needed, but I should doctor it a bit before to remove sensitive information.
EDIT: I include the part of the rsub
script which raises the error. Note that at this point in the script, $host=localhost
and $port=52698
. I double checked that with echo
statements.
# connect to textmate and send command
#
exec 3<> "/dev/tcp/$host/$port"
if [ $? -gt 0 ]; then
echo "Unable to connect to TextMate on $host:$port"
exit 1
fi
read -r server_info 0<&3
log $server_info
for i in "$!filepaths[@]"; do
open_file "$i"
done
echo "." 1>&3
if [[ $nowait = true ]]; then
exec </dev/null >/dev/null 2>/dev/null
( (handle_connection &) &)
else
handle_connection
fi
EDIT:I've been asked about the host OS. This is the result of uname -a
when on the remote host, and outside the Docker container (server name removed):
Linux xxxxxxx 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
and this is the result of the same command when run inside the Docker container:
Linux yyyyyyyyy 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
xxxxxxx
and yyyyyyy
are different strings. Also, when inside the Docker container, I can't find any directory tcp
inside the dev
directory:
root@7f199087c883:~# ls /dev/tcp
ls: cannot access '/dev/tcp': No such file or directory
networking server docker sublime-text perl
 |Â
show 1 more comment
up vote
2
down vote
favorite
I want to use the rsub package for Sublime Text, in order to edit code inside a Docker container which runs on a remote server. However when I execute
rsub my_code.py
I get the error:
/usr/local/bin/rsub: connect: Cannot assign requested address
/usr/local/bin/rsub: line 392: /dev/tcp/localhost/52698: Cannot assign requested address
Line 392 basically corresponds to this instruction:
exec 3<> "/dev/tcp/localhost/52698"
bash: connect: Cannot assign requested address
bash: /dev/tcp/localhost/52698: Cannot assign requested address
If I exit the Docker container and run the same instruction on the remote server, it works nicely (or at least it doesn't give me any error messages). Can you help me fix this problem? I can modify the Dockerfile if needed. I can also post it here if you think it's needed, but I should doctor it a bit before to remove sensitive information.
EDIT: I include the part of the rsub
script which raises the error. Note that at this point in the script, $host=localhost
and $port=52698
. I double checked that with echo
statements.
# connect to textmate and send command
#
exec 3<> "/dev/tcp/$host/$port"
if [ $? -gt 0 ]; then
echo "Unable to connect to TextMate on $host:$port"
exit 1
fi
read -r server_info 0<&3
log $server_info
for i in "$!filepaths[@]"; do
open_file "$i"
done
echo "." 1>&3
if [[ $nowait = true ]]; then
exec </dev/null >/dev/null 2>/dev/null
( (handle_connection &) &)
else
handle_connection
fi
EDIT:I've been asked about the host OS. This is the result of uname -a
when on the remote host, and outside the Docker container (server name removed):
Linux xxxxxxx 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
and this is the result of the same command when run inside the Docker container:
Linux yyyyyyyyy 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
xxxxxxx
and yyyyyyy
are different strings. Also, when inside the Docker container, I can't find any directory tcp
inside the dev
directory:
root@7f199087c883:~# ls /dev/tcp
ls: cannot access '/dev/tcp': No such file or directory
networking server docker sublime-text perl
it's actually a Perl script. I'm very bad with Perl...I can post the whole script, but I won't probably be able to create a MVE without someone else's help. Unfortunately the Perl whiz left...
â DeltaIV
May 17 at 17:05
I added the part of the Perl script, from the command which raises the error to the end. I can include the rest, if you want. It's about 400 lines, though.
â DeltaIV
May 17 at 17:08
1
Just a consideration, Docker containers are typically not "full OS" containers (like LXD or OpenVZ based VPSes are), and binding to ports might not behave the same way with them. As such, you may get it to work fine on the 'remote' host, but you might not be able to get it working on remote docker containers (which sit 'within' the host and have a NAT component).
â Thomas Wardâ¦
May 18 at 16:07
@ThomasWard indeed, it works fine on the 'remote' host when I'm outside the Docker container, as you predicted.
â DeltaIV
May 18 at 16:14
Keep in mind that with Docker, to bind to a port it's supposed to be configured in Docker container at runtime what ports are to be bound with. This said, if you can go into the Docker container, see if there's anything at/dev/tcp/localhost
. I'll bet the chances are there isn't one, and that this is a Docker-specific issue. Since I don't know the host OS in this equation (assuming Ubuntu), I can't give you any suggestions of where to look next, other than the standard "'It's a docker and how its containers work' problem." response :/
â Thomas Wardâ¦
May 18 at 16:16
 |Â
show 1 more comment
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I want to use the rsub package for Sublime Text, in order to edit code inside a Docker container which runs on a remote server. However when I execute
rsub my_code.py
I get the error:
/usr/local/bin/rsub: connect: Cannot assign requested address
/usr/local/bin/rsub: line 392: /dev/tcp/localhost/52698: Cannot assign requested address
Line 392 basically corresponds to this instruction:
exec 3<> "/dev/tcp/localhost/52698"
bash: connect: Cannot assign requested address
bash: /dev/tcp/localhost/52698: Cannot assign requested address
If I exit the Docker container and run the same instruction on the remote server, it works nicely (or at least it doesn't give me any error messages). Can you help me fix this problem? I can modify the Dockerfile if needed. I can also post it here if you think it's needed, but I should doctor it a bit before to remove sensitive information.
EDIT: I include the part of the rsub
script which raises the error. Note that at this point in the script, $host=localhost
and $port=52698
. I double checked that with echo
statements.
# connect to textmate and send command
#
exec 3<> "/dev/tcp/$host/$port"
if [ $? -gt 0 ]; then
echo "Unable to connect to TextMate on $host:$port"
exit 1
fi
read -r server_info 0<&3
log $server_info
for i in "$!filepaths[@]"; do
open_file "$i"
done
echo "." 1>&3
if [[ $nowait = true ]]; then
exec </dev/null >/dev/null 2>/dev/null
( (handle_connection &) &)
else
handle_connection
fi
EDIT:I've been asked about the host OS. This is the result of uname -a
when on the remote host, and outside the Docker container (server name removed):
Linux xxxxxxx 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
and this is the result of the same command when run inside the Docker container:
Linux yyyyyyyyy 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
xxxxxxx
and yyyyyyy
are different strings. Also, when inside the Docker container, I can't find any directory tcp
inside the dev
directory:
root@7f199087c883:~# ls /dev/tcp
ls: cannot access '/dev/tcp': No such file or directory
networking server docker sublime-text perl
I want to use the rsub package for Sublime Text, in order to edit code inside a Docker container which runs on a remote server. However when I execute
rsub my_code.py
I get the error:
/usr/local/bin/rsub: connect: Cannot assign requested address
/usr/local/bin/rsub: line 392: /dev/tcp/localhost/52698: Cannot assign requested address
Line 392 basically corresponds to this instruction:
exec 3<> "/dev/tcp/localhost/52698"
bash: connect: Cannot assign requested address
bash: /dev/tcp/localhost/52698: Cannot assign requested address
If I exit the Docker container and run the same instruction on the remote server, it works nicely (or at least it doesn't give me any error messages). Can you help me fix this problem? I can modify the Dockerfile if needed. I can also post it here if you think it's needed, but I should doctor it a bit before to remove sensitive information.
EDIT: I include the part of the rsub
script which raises the error. Note that at this point in the script, $host=localhost
and $port=52698
. I double checked that with echo
statements.
# connect to textmate and send command
#
exec 3<> "/dev/tcp/$host/$port"
if [ $? -gt 0 ]; then
echo "Unable to connect to TextMate on $host:$port"
exit 1
fi
read -r server_info 0<&3
log $server_info
for i in "$!filepaths[@]"; do
open_file "$i"
done
echo "." 1>&3
if [[ $nowait = true ]]; then
exec </dev/null >/dev/null 2>/dev/null
( (handle_connection &) &)
else
handle_connection
fi
EDIT:I've been asked about the host OS. This is the result of uname -a
when on the remote host, and outside the Docker container (server name removed):
Linux xxxxxxx 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
and this is the result of the same command when run inside the Docker container:
Linux yyyyyyyyy 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
xxxxxxx
and yyyyyyy
are different strings. Also, when inside the Docker container, I can't find any directory tcp
inside the dev
directory:
root@7f199087c883:~# ls /dev/tcp
ls: cannot access '/dev/tcp': No such file or directory
networking server docker sublime-text perl
edited May 18 at 16:29
asked May 17 at 16:58
DeltaIV
1314
1314
it's actually a Perl script. I'm very bad with Perl...I can post the whole script, but I won't probably be able to create a MVE without someone else's help. Unfortunately the Perl whiz left...
â DeltaIV
May 17 at 17:05
I added the part of the Perl script, from the command which raises the error to the end. I can include the rest, if you want. It's about 400 lines, though.
â DeltaIV
May 17 at 17:08
1
Just a consideration, Docker containers are typically not "full OS" containers (like LXD or OpenVZ based VPSes are), and binding to ports might not behave the same way with them. As such, you may get it to work fine on the 'remote' host, but you might not be able to get it working on remote docker containers (which sit 'within' the host and have a NAT component).
â Thomas Wardâ¦
May 18 at 16:07
@ThomasWard indeed, it works fine on the 'remote' host when I'm outside the Docker container, as you predicted.
â DeltaIV
May 18 at 16:14
Keep in mind that with Docker, to bind to a port it's supposed to be configured in Docker container at runtime what ports are to be bound with. This said, if you can go into the Docker container, see if there's anything at/dev/tcp/localhost
. I'll bet the chances are there isn't one, and that this is a Docker-specific issue. Since I don't know the host OS in this equation (assuming Ubuntu), I can't give you any suggestions of where to look next, other than the standard "'It's a docker and how its containers work' problem." response :/
â Thomas Wardâ¦
May 18 at 16:16
 |Â
show 1 more comment
it's actually a Perl script. I'm very bad with Perl...I can post the whole script, but I won't probably be able to create a MVE without someone else's help. Unfortunately the Perl whiz left...
â DeltaIV
May 17 at 17:05
I added the part of the Perl script, from the command which raises the error to the end. I can include the rest, if you want. It's about 400 lines, though.
â DeltaIV
May 17 at 17:08
1
Just a consideration, Docker containers are typically not "full OS" containers (like LXD or OpenVZ based VPSes are), and binding to ports might not behave the same way with them. As such, you may get it to work fine on the 'remote' host, but you might not be able to get it working on remote docker containers (which sit 'within' the host and have a NAT component).
â Thomas Wardâ¦
May 18 at 16:07
@ThomasWard indeed, it works fine on the 'remote' host when I'm outside the Docker container, as you predicted.
â DeltaIV
May 18 at 16:14
Keep in mind that with Docker, to bind to a port it's supposed to be configured in Docker container at runtime what ports are to be bound with. This said, if you can go into the Docker container, see if there's anything at/dev/tcp/localhost
. I'll bet the chances are there isn't one, and that this is a Docker-specific issue. Since I don't know the host OS in this equation (assuming Ubuntu), I can't give you any suggestions of where to look next, other than the standard "'It's a docker and how its containers work' problem." response :/
â Thomas Wardâ¦
May 18 at 16:16
it's actually a Perl script. I'm very bad with Perl...I can post the whole script, but I won't probably be able to create a MVE without someone else's help. Unfortunately the Perl whiz left...
â DeltaIV
May 17 at 17:05
it's actually a Perl script. I'm very bad with Perl...I can post the whole script, but I won't probably be able to create a MVE without someone else's help. Unfortunately the Perl whiz left...
â DeltaIV
May 17 at 17:05
I added the part of the Perl script, from the command which raises the error to the end. I can include the rest, if you want. It's about 400 lines, though.
â DeltaIV
May 17 at 17:08
I added the part of the Perl script, from the command which raises the error to the end. I can include the rest, if you want. It's about 400 lines, though.
â DeltaIV
May 17 at 17:08
1
1
Just a consideration, Docker containers are typically not "full OS" containers (like LXD or OpenVZ based VPSes are), and binding to ports might not behave the same way with them. As such, you may get it to work fine on the 'remote' host, but you might not be able to get it working on remote docker containers (which sit 'within' the host and have a NAT component).
â Thomas Wardâ¦
May 18 at 16:07
Just a consideration, Docker containers are typically not "full OS" containers (like LXD or OpenVZ based VPSes are), and binding to ports might not behave the same way with them. As such, you may get it to work fine on the 'remote' host, but you might not be able to get it working on remote docker containers (which sit 'within' the host and have a NAT component).
â Thomas Wardâ¦
May 18 at 16:07
@ThomasWard indeed, it works fine on the 'remote' host when I'm outside the Docker container, as you predicted.
â DeltaIV
May 18 at 16:14
@ThomasWard indeed, it works fine on the 'remote' host when I'm outside the Docker container, as you predicted.
â DeltaIV
May 18 at 16:14
Keep in mind that with Docker, to bind to a port it's supposed to be configured in Docker container at runtime what ports are to be bound with. This said, if you can go into the Docker container, see if there's anything at
/dev/tcp/localhost
. I'll bet the chances are there isn't one, and that this is a Docker-specific issue. Since I don't know the host OS in this equation (assuming Ubuntu), I can't give you any suggestions of where to look next, other than the standard "'It's a docker and how its containers work' problem." response :/â Thomas Wardâ¦
May 18 at 16:16
Keep in mind that with Docker, to bind to a port it's supposed to be configured in Docker container at runtime what ports are to be bound with. This said, if you can go into the Docker container, see if there's anything at
/dev/tcp/localhost
. I'll bet the chances are there isn't one, and that this is a Docker-specific issue. Since I don't know the host OS in this equation (assuming Ubuntu), I can't give you any suggestions of where to look next, other than the standard "'It's a docker and how its containers work' problem." response :/â Thomas Wardâ¦
May 18 at 16:16
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
2
down vote
In the end, since rsub
was working on the remote host, the simplest solution was to:
- log on to the remote host (without starting the container)
- use
rsub
to edit any files on the remote host, in a session of Sublime on my local pc - then build the container again.
It's a bit slow, because each time I make changes I need to rebuild, but:
- the remote host has a lot of computational power, so rebuilding is quick;
- it's a better way to work anyway: each time I commit changes to the project, I should rebuild the container anyway. This prompts me to commit changes more often, which is always a good idea :-)
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
In the end, since rsub
was working on the remote host, the simplest solution was to:
- log on to the remote host (without starting the container)
- use
rsub
to edit any files on the remote host, in a session of Sublime on my local pc - then build the container again.
It's a bit slow, because each time I make changes I need to rebuild, but:
- the remote host has a lot of computational power, so rebuilding is quick;
- it's a better way to work anyway: each time I commit changes to the project, I should rebuild the container anyway. This prompts me to commit changes more often, which is always a good idea :-)
add a comment |Â
up vote
2
down vote
In the end, since rsub
was working on the remote host, the simplest solution was to:
- log on to the remote host (without starting the container)
- use
rsub
to edit any files on the remote host, in a session of Sublime on my local pc - then build the container again.
It's a bit slow, because each time I make changes I need to rebuild, but:
- the remote host has a lot of computational power, so rebuilding is quick;
- it's a better way to work anyway: each time I commit changes to the project, I should rebuild the container anyway. This prompts me to commit changes more often, which is always a good idea :-)
add a comment |Â
up vote
2
down vote
up vote
2
down vote
In the end, since rsub
was working on the remote host, the simplest solution was to:
- log on to the remote host (without starting the container)
- use
rsub
to edit any files on the remote host, in a session of Sublime on my local pc - then build the container again.
It's a bit slow, because each time I make changes I need to rebuild, but:
- the remote host has a lot of computational power, so rebuilding is quick;
- it's a better way to work anyway: each time I commit changes to the project, I should rebuild the container anyway. This prompts me to commit changes more often, which is always a good idea :-)
In the end, since rsub
was working on the remote host, the simplest solution was to:
- log on to the remote host (without starting the container)
- use
rsub
to edit any files on the remote host, in a session of Sublime on my local pc - then build the container again.
It's a bit slow, because each time I make changes I need to rebuild, but:
- the remote host has a lot of computational power, so rebuilding is quick;
- it's a better way to work anyway: each time I commit changes to the project, I should rebuild the container anyway. This prompts me to commit changes more often, which is always a good idea :-)
answered May 18 at 17:45
DeltaIV
1314
1314
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037474%2fcannot-assign-address-inside-a-docker-container%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
it's actually a Perl script. I'm very bad with Perl...I can post the whole script, but I won't probably be able to create a MVE without someone else's help. Unfortunately the Perl whiz left...
â DeltaIV
May 17 at 17:05
I added the part of the Perl script, from the command which raises the error to the end. I can include the rest, if you want. It's about 400 lines, though.
â DeltaIV
May 17 at 17:08
1
Just a consideration, Docker containers are typically not "full OS" containers (like LXD or OpenVZ based VPSes are), and binding to ports might not behave the same way with them. As such, you may get it to work fine on the 'remote' host, but you might not be able to get it working on remote docker containers (which sit 'within' the host and have a NAT component).
â Thomas Wardâ¦
May 18 at 16:07
@ThomasWard indeed, it works fine on the 'remote' host when I'm outside the Docker container, as you predicted.
â DeltaIV
May 18 at 16:14
Keep in mind that with Docker, to bind to a port it's supposed to be configured in Docker container at runtime what ports are to be bound with. This said, if you can go into the Docker container, see if there's anything at
/dev/tcp/localhost
. I'll bet the chances are there isn't one, and that this is a Docker-specific issue. Since I don't know the host OS in this equation (assuming Ubuntu), I can't give you any suggestions of where to look next, other than the standard "'It's a docker and how its containers work' problem." response :/â Thomas Wardâ¦
May 18 at 16:16