We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Exec

When it comes to deploying applications with Docker, you'll usually just let the container do its thing. For example, the Ghost container we ran in the last chapter started up its own web server (based on the image configuration). We didn't need to run any manual commands in addition to just starting the container.

That said, it is possible to run commands inside a running container! It's kinda like the container version of sshing into a remote server and running a command.

Assignment

docker ps
docker run -d -p 8965:80 docker/getting-started
docker ps
docker exec CONTAINER_ID ls

You should get a list of all the files and directories in the working directory (which happens to be the root in this case) of the container!

Run and submit the CLI tests.