If the main goal of your program is to read and write local files, consider running it not in Docker. That completely avoids the container-lifecycle and filesystem-mapping issues you're running into.
sudo apt install snapd
sudo systemctl start snapd
sudo snap install amass
./bin/amass --passive -d example.com -o out.txt
Otherwise, Docker containers have their own separate filesystems, and need to explicitly be given access to host-system files. See the Docker documentation on bind mounts. You might run this program like
sudo docker build -t amass https://github.com/OWASP/Amass.git
sudo docker run --rm -v $PWD:/data \
amass --passive -d example.com -o /data/out.txt
cat out.txt
Note that you can specify any host directory in the docker run -v
options, even system directories like /etc
and /bin
, and for that reason I've explicitly called out the steps that require root-equivalent permissions (membership in a docker
group is equivalent to having root). Also note that without Docker you can run the tool as an ordinary user, but to run the Docker container you must effectively be root.
If your problem is that the container is exiting ("...in a stopped state") your very first step should be to look at docker logs
and run the container in the foreground without the -d
option to understand why. While docker exec
is a useful debugging tool it wasn't designed to be the primary way to interact with a container.