mirror of
https://github.com/wsargent/docker-cheat-sheet.git
synced 2025-09-22 05:40:50 +02:00
Added options -td and --name for docker run
Added options -td and --name for docker run with the full explanation about them.
This commit is contained in:
parent
5845011bdc
commit
4b95c79cc5
1 changed files with 4 additions and 0 deletions
|
@ -101,6 +101,8 @@ If you are a complete Docker newbie, you should probably follow the [series of t
|
|||
* [`docker rm`](https://docs.docker.com/engine/reference/commandline/rm) deletes a container.
|
||||
* [`docker update`](https://docs.docker.com/engine/reference/commandline/update/) updates a container's resource limits.
|
||||
|
||||
Normally if you run a container without options it will start and stop immediately, if you want keep it running you can use the command, `docker run -td container_id` this will use the option -t that will allocate a pseudo-TTY session and -d that will detach automatically the container (run container in background and print container ID).
|
||||
|
||||
If you want a transient container, `docker run --rm` will remove the container after it stops.
|
||||
|
||||
If you want to map a directory on the host to a docker container, `docker run -v $HOSTDIR:$DOCKERDIR`. Also see [Volumes](https://github.com/wsargent/docker-cheat-sheet/#volumes).
|
||||
|
@ -109,6 +111,8 @@ If you want to remove also the volumes associated with the container, the deleti
|
|||
|
||||
There's also a [logging driver](https://docs.docker.com/engine/admin/logging/overview/) available for individual containers in docker 1.10. To run docker with a custom log driver (i.e., to syslog), use `docker run --log-driver=syslog`.
|
||||
|
||||
Another useful option is `docker run --name yourname docker_image` because when you specify the --name inside the run command this will allow you to start and stop a container by calling it with the name the you specified when you created it.
|
||||
|
||||
### Starting and Stopping
|
||||
|
||||
* [`docker start`](https://docs.docker.com/engine/reference/commandline/start) starts a container so it is running.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue