0

Able to get a response from the docker hub basex container:

nicholas $ 
nicholas $ lynx http://localhost:8984/ --dump
No function found that matches the request.
nicholas $ 

Ran the container as:

root $ 
root $ docker run -ti     -d     --name basexhttp     --publish 1984:1984     --publish 8984:8984     --volume "$(pwd)/basex/data":/srv/basex/data     basex/basexhttp:latest
71cbb84cf53143d00e6009d1ea5caa9de96c094c5d6aefc11cad95188b976776
root $ 
root $ docker container list
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                                      NAMES
71cbb84cf531        basex/basexhttp:latest   "/usr/local/bin/mvn-…"   26 seconds ago      Up 23 seconds       0.0.0.0:1984->1984/tcp, 0.0.0.0:8984->8984/tcp, 8985/tcp   basexhttp
root $ 
root $ docker run -ti basex/basexhttp:latest bash
bash-4.4$ 
bash-4.4$ whoami
basex
bash-4.4$ 
bash-4.4$ pwd
/srv
bash-4.4$ 
bash-4.4$ sudo su -
bash: sudo: command not found
bash-4.4$ 
bash-4.4$ su -
su: must be suid to work properly
bash-4.4$ 

but how do I gain root access?

1

Solution is to use exec as:

root@doge:~# 
root@doge:~# docker run -ti     -d     --name basexhttp     --publish 1984:1984     --publish 8984:8984     --volume "$(pwd)/basex/data":/srv/basex/data     basex/basexhttp:latest
5699af1dc04aa9c78066222e4b0b8e5621aa2ab9dd2bd46bcd87c6a0377c1960
root@doge:~# 
root@doge:~# docker container list
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                                      NAMES
5699af1dc04a        basex/basexhttp:latest   "/usr/local/bin/mvn-…"   33 seconds ago      Up 30 seconds       0.0.0.0:1984->1984/tcp, 0.0.0.0:8984->8984/tcp, 8985/tcp   basexhttp
root@doge:~# 
root@doge:~# docker exec -ti --user root basexhttp bash
bash-4.4# 
bash-4.4# whoami
root
bash-4.4# 
bash-4.4# su basex
~ $ 
~ $ whoami
basex
~ $ 
~ $ exit
bash-4.4# exit
exit
root@doge:~# 
root@doge:~# docker container list
CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS              PORTS                                                      NAMES
5699af1dc04a        basex/basexhttp:latest   "/usr/local/bin/mvn-…"   About a minute ago   Up About a minute   0.0.0.0:1984->1984/tcp, 0.0.0.0:8984->8984/tcp, 8985/tcp   basexhttp
root@doge:~# 
root@doge:~# docker ps -a
CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS              PORTS                                                      NAMES
5699af1dc04a        basex/basexhttp:latest   "/usr/local/bin/mvn-…"   About a minute ago   Up About a minute   0.0.0.0:1984->1984/tcp, 0.0.0.0:8984->8984/tcp, 8985/tcp   basexhttp
root@doge:~# 
1
  • 1
    You should combine both your answers and accept the resulting one. Otherwise it's a bit confusing. – Konrad Botor Sep 4 '20 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.