Docker

Execute a shell into a running docker container

docker exec -it <container_id> bash

If you don't know the container id you can run the following command to find it:

docker ps

If you are running docker compose you can get a bash shell by running:

docker compose exec <service name> bash

Copy a file to or from a container

Copy a file to a container

docker cp somefile.txt <container_id>:/somefile.txt

Copy a directory to a container

docker cp localdir/. <container_id>:/remotedir

Copy a file from a container

docker cp <container_id>:/somefile.txt somefile.txt

Copy a directory from a container to host

docker cp <container_id>:/remotedir localdir