shenxn / protonmail-bridge-docker

ProtonMail IMAP/SMTP Bridge Docker container
GNU General Public License v3.0
382 stars 77 forks source link

Get password after starting / initializing the docker container #50

Open JVT038 opened 2 years ago

JVT038 commented 2 years ago

Hi, I want to add a new client to the protonmail-bridge container, however I don't know the password. How do I get back into the protonmail-cli and fetch my account info?

arifer612 commented 2 years ago

There are 2 ways to do this. The first is to stop the container and start an interactive container and the second is to kill the relevant processes and start afresh.

First method (recommended)

  1. Stop your protonmail-bridge container and enter the interactive shell
docker stop protonmail-bridge
docker run --rm -it -v protonmail:/root shenxn/protonmail-bridge init
  1. Once you are in the container, just wait until protonmail-bridge has initialised. You will be able to see an ASCII image of a bridge when that happens:
         Welcome to ProtonMail Bridge interactive shell
                           ___....___
 ^^                __..-:'':__:..:__:'':-..__
               _.-:__:.-:'':  :  :  :'':-.:__:-._
             .':.-:  :  :  :  :  :  :  :  :  :._:'.
          _ :.':  :  :  :  :  :  :  :  :  :  :  :'.: _
         [ ]:  :  :  :  :  :  :  :  :  :  :  :  :  :[ ]
         [ ]:  :  :  :  :  :  :  :  :  :  :  :  :  :[ ]
:::::::::[ ]:__:__:__:__:__:__:__:__:__:__:__:__:__:[ ]:::::::::::
!!!!!!!!![ ]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![ ]!!!!!!!!!!!
^^^^^^^^^[ ]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[ ]^^^^^^^^^^^
         [ ]                                        [ ]
         [ ]                                        [ ]
   jgs   [ ]                                        [ ]
 ~~^_~^~/   \~^-~^~ _~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^/   \~^ ~~_ ^
>>>
  1. You can now do whatever you wish to do. For example, you can get the password by running info in the interactive shell. Once done, exit the container and restart your main daemonised container.
exit
docker restart protonmail-bridge

Second method

  1. Enter the interactive shell for your protonmail-bridge container through the following:
docker exec -ti protonmail-bridge /bin/bash
  1. Kill all relevant processes and restart protonmail-bridge
ps aux | grep [b]ridge | awk '{print $2}' | xargs -I {} kill -9 {}
./entrypoint.sh init
  1. Wait until protonmail-bridge has initialised. You will be able to see an ASCII image of a bridge when that happens:
         Welcome to ProtonMail Bridge interactive shell
                           ___....___
 ^^                __..-:'':__:..:__:'':-..__
               _.-:__:.-:'':  :  :  :'':-.:__:-._
             .':.-:  :  :  :  :  :  :  :  :  :._:'.
          _ :.':  :  :  :  :  :  :  :  :  :  :  :'.: _
         [ ]:  :  :  :  :  :  :  :  :  :  :  :  :  :[ ]
         [ ]:  :  :  :  :  :  :  :  :  :  :  :  :  :[ ]
:::::::::[ ]:__:__:__:__:__:__:__:__:__:__:__:__:__:[ ]:::::::::::
!!!!!!!!![ ]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![ ]!!!!!!!!!!!
^^^^^^^^^[ ]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[ ]^^^^^^^^^^^
         [ ]                                        [ ]
         [ ]                                        [ ]
   jgs   [ ]                                        [ ]
 ~~^_~^~/   \~^-~^~ _~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^/   \~^ ~~_ ^
>>>
  1. You can now do whatever you wish to do. For example, you can get the password by running info in the interactive shell. Once done, exit the interactive shell and you are good to go!
Darkdragon84 commented 7 months ago

Hi! First of all thanks for the awesome image, it's so great that the bridge generated password persists across container restarts!

I too would love to have a way to interact with the console every now and then. However, I find it a bit unhandy to having to stop the container, run it with init, stop and remove again and restart the bridge. Isn't there a way to attach to the running bridge service? I suppose the difficulty arises from the faketty?

Cheers