Difference between revisions of "Docker"
From Teknologisk videncenter
m |
m |
||
| Line 15: | Line 15: | ||
|docker run -d -p 8080:80 nginx || Run image nginx detach (portmap redirect 8080->80) public to private - See rule with '''iptables -L -t nat -n''' or '''nft list ruleset''' | |docker run -d -p 8080:80 nginx || Run image nginx detach (portmap redirect 8080->80) public to private - See rule with '''iptables -L -t nat -n''' or '''nft list ruleset''' | ||
|- | |- | ||
| + | |/home/heth/containers/nginx# docker run -d -p 8080:80 -v /home/heth/containers/nginx:/usr/share/nginx/html nginx || Same as above but with volume map | ||
| + | - | ||
|docker run -it ubuntu|| Run image ubuntu in container ( -it = interactive tty ) | |docker run -it ubuntu|| Run image ubuntu in container ( -it = interactive tty ) | ||
|- | |- | ||
Revision as of 15:41, 22 September 2024
| command | Explanation | ||
|---|---|---|---|
| docker ps | Status of running containers | ||
| docker container ls | Status of running containers (As above) | ||
| docker run ubuntu | Run image ubuntu in containe (Terminates as its bash exits) - pull container if not present | ||
| docker run -d nginx | Run image nginx detach (as daemon stdin/stdout detached) | ||
| docker run -d -p 8080:80 nginx | Run image nginx detach (portmap redirect 8080->80) public to private - See rule with iptables -L -t nat -n or nft list ruleset | ||
| /home/heth/containers/nginx# docker run -d -p 8080:80 -v /home/heth/containers/nginx:/usr/share/nginx/html nginx | Same as above but with volume map
- |
docker run -it ubuntu | Run image ubuntu in container ( -it = interactive tty ) |
| docker pull nginx | pull container from repository (default docker hub) |