差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
docker:docker:basic_commands [2024/01/14 10:20] tony |
docker:docker:basic_commands [2024/01/14 22:42] (目前版本) tony |
||
---|---|---|---|
行 9: | 行 9: | ||
localhost/http-sample_http-service latest f8dec1371ce9 9 hours ago 44.4 MB | localhost/http-sample_http-service latest f8dec1371ce9 9 hours ago 44.4 MB | ||
docker.io/library/nginx alpine 529b5644c430 2 months ago 44.4 MB | docker.io/library/nginx alpine 529b5644c430 2 months ago 44.4 MB | ||
+ | </code> | ||
+ | 刪除image: | ||
+ | <code bash> | ||
+ | docker rmi image_name | ||
</code> | </code> | ||
===== Containers ===== | ===== Containers ===== | ||
行 19: | 行 23: | ||
621e03be78a6 localhost/http-sample_http-service:latest nginx -g daemon o... 9 hours ago Exited (0) 9 hours ago http-sample_http-service_1 | 621e03be78a6 localhost/http-sample_http-service:latest nginx -g daemon o... 9 hours ago Exited (0) 9 hours ago http-sample_http-service_1 | ||
</code> | </code> | ||
- | 停止、啟動、重啟container: | + | 停止、啟動、重啟container、刪除: |
<code bash> | <code bash> | ||
docker stop container_name_or_id | docker stop container_name_or_id | ||
docker start container_name_or_id | docker start container_name_or_id | ||
docker restart container_name_or_id | docker restart container_name_or_id | ||
+ | docker rm container_name_or_id | ||
+ | </code> | ||
+ | 查詢container log: | ||
+ | <code bash> | ||
+ | [root@localhost http-sample]# docker logs 41c242135b04 | ||
+ | Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. | ||
+ | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration | ||
+ | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ | ||
+ | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh | ||
+ | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf | ||
+ | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf | ||
+ | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh | ||
+ | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh | ||
+ | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh | ||
+ | /docker-entrypoint.sh: Configuration complete; ready for start up | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: using the "epoll" event method | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: nginx/1.25.3 | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10) | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: OS: Linux 5.14.0-284.11.1.el9_2.x86_64 | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: start worker processes | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: start worker process 25 | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: start worker process 26 | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: start worker process 27 | ||
+ | 2024/01/14 02:29:39 [notice] 1#1: start worker process 28 | ||
+ | </code> | ||
+ | 查詢詳細資訊: | ||
+ | <code bash> | ||
+ | docker inspect container_name_or_id | ||
+ | </code> | ||
+ | 進入container內使用shell: | ||
+ | <code bash> | ||
+ | docker exec -it container_name_or_id /bin/sh | ||
+ | </code> | ||
+ | ===== Docker-Compose ===== | ||
+ | 在對應的目錄直接執行去啟動或停止docker-compose。 | ||
+ | <code bash> | ||
+ | podman-compose up | ||
+ | podman-compose down | ||
+ | </code> | ||
+ | 假如懷疑build container過程發生問題要看log, | ||
+ | <code bash> | ||
+ | podman-compose up -build | ||
</code> | </code> |