You can use conainers in 3 different ways.
- To run a single command
- Running run as a shell
- Running in the background
docker container run [options] [image:version] [hostname]
docker container run --interactive --tty [options] [image:version] [shell]
--interactive
says you want an interactive session--tty
allocates a pseudo-tty[shell]
is the command to run your shell of choice
docker container run --detach --name [name] [options] [image:version]
--detach
runs container in background--name [name]
sets the name of the container
Although this contianer is running the background, you still have the ability push commands to the container or even open a shell docker exec -it [name] [command]
- to start a shell, make your command your prefered shell
- List Running Containers
docker container ls
- List all containers reguardless of status
docker container ls -a
- Show logs
docker container logs [name]
- Show running processes
docker container top [name]