It works with ubuntu image
wolf@linux:~$ docker run -it ubuntu /bin/bash
root@00e6296d31d8:/#
However, when I try it with different image such as vulnerables/web-dvwa
, it doesn't work anymore
wolf@linux:~$ docker run -it vulnerables/web-dvwa /bin/bash
[+] Starting mysql...
[ ok ] Starting MariaDB database server: mysqld.
[+] Starting apache
[....] Starting Apache httpd web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
. ok
==> /var/log/apache2/access.log <==
==> /var/log/apache2/error.log <==
[Sat Apr 03 11:54:24.321232 2021] [mpm_prefork:notice] [pid 307] AH00163: Apache/2.4.25 (Debian) configured -- resuming normal operations
[Sat Apr 03 11:54:24.321280 2021] [core:notice] [pid 307] AH00094: Command line: '/usr/sbin/apache2'
==> /var/log/apache2/other_vhosts_access.log <==
id
whoami
There is no bash shell in this container
wolf@linux:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
820d3a292b2c vulnerables/web-dvwa "/main.sh /bin/bash" 11 seconds ago Up 11 seconds 80/tcp upbeat_visvesvaraya
wolf@linux:~$
You can attach to the container with:
or:
That image you are trying to run i.e.
vulnerables/web-dvwa
containsENTRYPOINT ["/main.sh"]
which runs mysqld on startup. If you need a just a shell in that image you can override the main entry like so below ...OR if you want a shell on the running mysqld container, you can run it normally w/ out
-it
argument and then do the following to get a bash shell in the running container.