Can't access 127.0.0.1:port when using docker

When I start a new docker container with the rclone image following the installation instructions i can't get past the config setup. When it gets to the part where it asks to visit 127.0.0.1:port, i can't access it.

The command i use to create the container:

docker run -it --rm \
    --volume ~/.config/rclone:/config/rclone \
    --volume ~/data:/data:shared \
    --user $(id -u):$(id -g) \
    -p port:port
    rclone/rclone \
    config

I cant remeber the correct port but i have forwarded the port correctly. I also added -it because without that it didn't work. I'm clearly doing something wrong and i cant figure out what it is.

hello and welcome to the forum,

rclone config with gdrive uses oauth, which requires a web browser.

not a docker expert, but i think you have at least three choices
--- run rclone config on a host, and in the docker container.
rclone will use that config file based on --volume ~/.config/rclone:/config/rclone
--- run rclone config headless mode in the docker container
https://rclone.org/remote_setup/
--- use a gdrive service account file, which does not use oauth.

Why does the link the config command gives me use 127.0.0.1? I used rclone 1.5 years ago and wasnt the link a long link straight to google drive or some other google service, not 127.0.0.1?

run rclone config on a host, and in the docker container.

This would work, but the reason i want to use docker is so i dont need to install rclone locally.

that is how rclone works. perhaps in the past, it was different.
regardless of the link addresses, need a web browser to complete oauth process.
or
use a gdrive service account file, which does not use oauth, does not use a web browser.

I could access the link on my host machine, the one im running docker on. I guess i'll install rclone locally and use it that way. Thanks!

you can run rclone config on the host and then move the config file into the container.
or
better yet, as i suggested,
https://rclone.org/remote_setup/

This would require rclone to be installed on my host machine which would defeat the purpose of what im trying to do

not sure that you need to install rclone on the host, did you try this?

rclone config

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> test
Storage> drive

Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> n
Option config_verification_code.
Verification code
Go to this URL, authenticate then paste the code here.
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=xxx.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=KxUhhTHdNE5s2ugEZMGqPA
Enter a string value. Press Enter for the default ("").
config_verification_code> 4XfWjqBynaorRDKhDJfZ-RBFyj5Tr3h5h61ES95xRnGr_fZ_lPF1zKg8E
Configure this as a Shared Drive (Team Drive)?

y) Yes
n) No (default)
y/n> n
--------------------
[aza]
type = drive
token = {"access_token":"ya29.-vAUf-ZucCIPG624DBQjdRrc47eaRCC7Db1jYKxM7nuPS319seuRwmmxGRJMzAKzW3eCvesGI569MdqzROCd_uQu6me1M1ef","token_type":"Bearer","refresh_token":"1//0dNaheA7dRtWECgYIARAAGA0SNwF-L9IrGpDq76Qj8-TRyGAvrRBhkc-GoXrfSzcCp9Qcw2GR5KdKUV5GYPZJAQ2qTnpeFgqlVrk","expiry":"2022-03-23T14:16:51.5401108-04:00"}
team_drive =
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>

This is the output i get:

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> demo
Storage> drive

Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a value. Press Enter to leave empty.
client_id>

Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>

Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Full access all files, excluding Application Data Folder.
   \ (drive)
 2 / Read-only access to file metadata and file contents.
   \ (drive.readonly)
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ (drive.file)
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ (drive.appfolder)
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ (drive.metadata.readonly)
scope> 1

Option root_folder_id.
ID of the root folder.
Leave blank normally.
Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.
Enter a value. Press Enter to leave empty.
root_folder_id>

Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>

Edit advanced config?
y) Yes
n) No (default)
y/n>

Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> n

Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
	rclone authorize "drive" "eyJzY29wZSI6ImRyaXZlIn0"
Then paste the result.
Enter a value.
config_token>

That accounts.google.com link you have is the one im talking about.

when you posted, there was a template of questions, including to post the full output of rclone version

and as i suggested, what i do, use a gdrive service account file.
--- no need for oauth
--- no need for web browser
--- no need to install rclone on host.

The version that the latest docker image has is 1.58.0. I also tried installing rclone with apt install rclone on ubuntu and that installs version 1.50.2. I tried rclone config with that version and it gives me the accounts.google.com link. I also tested this by picking out an older docker image that has version 1.50.2. This also gives out the link and im able to connect it to google drive. It seems like the output of rclone config was changed somewhere between those versions.

i am using v1.57.0 and based on the text i posted, that worked well.

if you search the forum for OOB, you will find that google made some change on their end.
as a result, rclone had to make a change.
and you can read about it here

I was able to get it working by using version 1.57.0. Thanks for your help!

good!

now that the config file has been created,
as i understand it, you can update rclone to v1.58.0

as i understand it, you can update rclone to v1.58.0

Yes, v1.58.0 works great now.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.