`docker exec` is a debugging command to run an additional command in a Docker container. Use this tag for questions about the Docker exec subsystem, especially invoking it through a Docker SDK.
docker exec
is a debugging command to run an additional command in a docker container. A typical use could be to inspect the container filesystem after a container has already started up:
# Start the container
docker run -d --name container-name ...
# See what is in the container's `/data` directory
docker exec container-name ls /data
The command can also be invoked using the longer alias docker container exec
. For docker-compose based setups, docker-compose exec name command
will use the container's Compose service name, without needing to know the generated container name.
Programming-related questions about docker exec
will generally focus on invoking it through a Docker SDK. Some debugging tasks may be on-topic as well.