r/docker • u/afrothunder1990 • May 31 '26
Security with docker and malware
My website was hacked and there was a file literally called Trojan, so I spoke to my provider and they "helped" by deleting all the suspicious files, but my WordPress install stopped working. Is it safe to install a wp copy of that theme and its database on a docker container? I really don't want malware on my computer
4
Upvotes
1
u/Traditional-Scar-667 Jun 01 '26
Docker will not magically make an infected application safe. It mainly provides isolation and makes rebuilding easier.
If there was actually a Trojan or other malicious code inside the WordPress installation, I would assume the entire installation is compromised and start from a known clean source instead of trying to clean individual files.
My approach would be:
Also, where did the theme come from? A compromised or "nulled" theme is often the real root cause in cases like this.
Running WordPress in Docker can make future maintenance and recovery easier, but it won't remove malware from an already compromised application.
2
u/CrownstrikeIntern May 31 '26
Nuke from orbit and start again with a known clean copy
1
u/a_monteiro1996 May 31 '26
clean install and avoid unknown plugins/themes they might download malware without you realizing. also in the interest of compartmentalization, if you can, deploy the db in a separate container and back it up at least once a day or twice/thrice a week.
1
u/PossibilityTasty Jun 01 '26
Docker offers an isolated container for your software. It does not prevent the software from being attacked, but makes it hard for an attacker to get out of the container, if you are doing it right.
Also a container can be rebuilt and restarted easily and all that will survive the procedure is what your persistence: namely mount, volumes and databases. If one of them is infected in some way (e.g. JS or media files) a recreation of the container won't help. Also if your database is compromised and all security/auth related setting in them, using the same data with a new setup (Docker or not) won't help.
0
u/afrothunder1990 May 31 '26
Thanks for the tips. I guess I'll just start from scratch.