{"id":35044,"date":"2024-10-21T14:20:01","date_gmt":"2024-10-21T07:20:01","guid":{"rendered":"http:\/\/jupitek.maudemo.vip\/index.php\/2024\/10\/21\/how-to-deploy-an-nginx-container-with-docker-on-linode\/"},"modified":"2024-10-21T14:20:01","modified_gmt":"2024-10-21T07:20:01","slug":"how-to-deploy-an-nginx-container-with-docker-on-linode","status":"publish","type":"post","link":"https:\/\/jupitek.maudemo.vip\/index.php\/2024\/10\/21\/how-to-deploy-an-nginx-container-with-docker-on-linode\/","title":{"rendered":"Tri\u1ec3n khai m\u1ed9t nginx Container b\u1eb1ng Docker tr\u00ean Linode"},"content":{"rendered":"<h2 id=\"what-is-a-docker-container\">Docker Container l\u00e0 g\u00ec?<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/#what-is-a-docker-container\"><\/a><\/h2>\n<p>Theo Docker.com, container l\u00e0 \u201cm\u1ed9t ph\u1ea7n m\u1ec1m nh\u1eb9, \u0111\u1ed9c l\u1eadp, c\u00f3 th\u1ec3 th\u1ef1c thi, bao g\u1ed3m m\u1ecdi th\u1ee9 c\u1ea7n thi\u1ebft \u0111\u1ec3 ch\u1ea1y n\u00f3: m\u00e3, th\u1eddi gian ch\u1ea1y, c\u00f4ng c\u1ee5 h\u1ec7 th\u1ed1ng, th\u01b0 vi\u1ec7n h\u1ec7 th\u1ed1ng v\u00e0 c\u00e0i \u0111\u1eb7t\u201d. Container c\u00f4 l\u1eadp ph\u1ea7n m\u1ec1m kh\u1ecfi m\u00f4i tr\u01b0\u1eddng xung quanh v\u00e0 \u0111\u01b0\u1ee3c t\u1ea1o t\u1eeb c\u00e1c h\u00ecnh \u1ea3nh \u0111\u01b0\u1ee3c k\u00e9o t\u1eeb s\u1ed5 \u0111\u0103ng k\u00fd Docker. V\u00ed d\u1ee5, b\u1ea1n c\u00f3 th\u1ec3 k\u00e9o h\u00ecnh \u1ea3nh nginx v\u00e0 t\u1ea1o bao nhi\u00eau container t\u1eeb n\u00f3 t\u00f9y theo nhu c\u1ea7u.<\/p>\n<h2 id=\"docker-command-syntax\">C\u00fa ph\u00e1p l\u1ec7nh Docker<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/#docker-command-syntax\"><\/a><\/h2>\n<p>Tri\u1ec3n khai v\u00f9ng ch\u1ee9a Docker b\u1eb1ng c\u00fa ph\u00e1p sau:<\/p>\n<pre class=\"wp-block-code\"><code>docker run \u2013name CONTAINER-NAME -p NETWORK_PORT:CONTAINER_PORT IMAGE NAME\n<\/code><\/pre>\n<p>N\u00f3 bao g\u1ed3m:<\/p>\n<ul>\n<li><code>CONTAINER-NAME<\/code>: T\u00ean b\u1ea1n \u0111\u1eb7t cho th\u00f9ng ch\u1ee9a.<\/li>\n<li><code>NETWORK_PORT<\/code>: M\u1ed9t c\u1ed5ng c\u00f3 s\u1eb5n cho m\u1ea1ng.<\/li>\n<li><code>CONTAINER_PORT<\/code>: C\u1ed5ng m\u00e0 container s\u1ebd l\u1eafng nghe.<\/li>\n<li><code>IMAGE NAME<\/code>: T\u00ean c\u1ee7a h\u00ecnh \u1ea3nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho v\u00f9ng ch\u1ee9a.<\/li>\n<\/ul>\n<h2 id=\"deploy-a-container\">Tri\u1ec3n khai m\u1ed9t Container<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/#deploy-a-container\"><\/a><\/h2>\n<p>V\u00ed d\u1ee5 n\u00e0y s\u1ebd t\u1ea1o m\u1ed9t container nginx v\u1edbi c\u1ed5ng 80 \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb, s\u1eed d\u1ee5ng h\u00ecnh \u1ea3nh nginx ch\u00ednh th\u1ee9c.<\/p>\n<p>1.X\u00e1c nh\u1eadn h\u00ecnh \u1ea3nh ch\u00ednh th\u1ee9c hi\u1ec7n t\u1ea1i:<\/p>\n<pre class=\"wp-block-code\"><code>docker images<\/code><\/pre>\n<p>Trong \u1ea3nh ch\u1ee5p m\u00e0n h\u00ecnh n\u00e0y, h\u00ecnh \u1ea3nh nginx \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea3i l\u00ean hai tu\u1ea7n tr\u01b0\u1edbc:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/docker-container-images_hu658f79557572f35f9b81711900915eb2_42638_1388x0_resize_q71_bgfafafc_catmullrom_3.jpg\" alt=\"DockerContainerH\u00ecnh \u1ea3nh\" title=\"DockerContainerH\u00ecnh \u1ea3nh\"\/><\/figure>\n<p>2.C\u1eadp nh\u1eadt h\u00ecnh \u1ea3nh g\u1ed1c nh\u01b0&nbsp;<code>docker pull nginx<\/code>\u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb trong h\u01b0\u1edbng d\u1eabn&nbsp;<a href=\"https:\/\/www.linode.com\/docs\/guides\/installing-and-using-docker-on-ubuntu-and-debian\/\">C\u00e1ch c\u00e0i \u0111\u1eb7t Docker v\u00e0 k\u00e9o h\u00ecnh \u1ea3nh \u0111\u1ec3 tri\u1ec3n khai container<\/a>&nbsp;. Ch\u1ea1y&nbsp;<code>docker images<\/code>l\u1ea1i \u0111\u1ec3 x\u00e1c nh\u1eadn b\u1ea3n c\u1eadp nh\u1eadt:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/docker-container-pull-new-image_hu658f79557572f35f9b81711900915eb2_88822_1388x0_resize_q71_bgfafafc_catmullrom_3.jpg\" alt=\"Docker Pull H\u00ecnh \u1ea3nh nginx m\u1edbi\"><\/p>\n<p>3.Tri\u1ec3n khai container:<\/p>\n<p><code>docker run --name docker-nginx -p 80:80 -d nginx <\/code>\u0110i\u1ec1u n\u00e0y s\u1ebd hi\u1ec3n th\u1ecb ID m\u1edbi \u0111\u01b0\u1ee3c t\u1ea1o cho container. L\u01b0u \u00fd r\u1eb1ng t\u00f9y ch\u1ecdn&nbsp;<code>-d<\/code>,&nbsp;<em>t\u00e1ch<\/em>&nbsp;, s\u1ebd \u0111\u01b0a b\u1ea1n tr\u1edf l\u1ea1i d\u1ea5u nh\u1eafc:<img decoding=\"async\" src=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/docker-container-run-container_hu658f79557572f35f9b81711900915eb2_41454_1388x0_resize_q71_bgfafafc_catmullrom_3.jpg\" alt=\"Ch\u1ea1y Docker\"><\/p>\n<p>4.X\u00e1c nh\u1eadn container \u0111ang ch\u1ea1y:<\/p>\n<pre class=\"wp-block-code\"><code>docker ps -a\n<\/code><\/pre>\n<p>5.\u0110i\u1ec1u h\u01b0\u1edbng \u0111\u1ebfn \u0111\u1ecba ch\u1ec9 IP Linode c\u1ee7a b\u1ea1n \u0111\u1ec3 xem th\u00f4ng b\u00e1o ch\u00e0o m\u1eebng nginx m\u1eb7c \u0111\u1ecbnh:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/docker-container-welcome-to-nginx.png\" alt=\"Ch\u00e0o m\u1eebng \u0111\u1ebfn v\u1edbi nginx\" width=\"588\" height=\"254\"><\/p>\n<h2 id=\"how-to-stop-and-delete-containers\">C\u00e1ch d\u1eebng v\u00e0 x\u00f3a c\u00e1c container<a href=\"https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/#how-to-stop-and-delete-containers\"><\/a><\/h2>\n<p>1.D\u1eebng container b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng m\u1ed9t v\u00e0i k\u00fd t\u1ef1 \u0111\u1ea7u ti\u00ean c\u1ee7a ID container (&nbsp;<code>e468<\/code>trong v\u00ed d\u1ee5 n\u00e0y):<\/p>\n<pre class=\"wp-block-code\"><code>docker stop e468\n<\/code><\/pre>\n<p>2.X\u00f3a container b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng&nbsp;<code>rm<\/code>l\u1ec7nh v\u00e0 c\u00f9ng m\u1ed9t ID container:<\/p>\n<pre class=\"wp-block-code\"><code>docker rm e468\n<\/code><\/pre>\n<h2 id=\"more-information\">Th\u00f4ng tin th\u00eam<\/h2>\n<p>B\u1ea1n c\u00f3 th\u1ec3 mu\u1ed1n tham kh\u1ea3o c\u00e1c ngu\u1ed3n sau \u0111\u1ec3 bi\u1ebft th\u00eam th\u00f4ng tin v\u1ec1 ch\u1ee7 \u0111\u1ec1 n\u00e0y. M\u1eb7c d\u00f9 ch\u00fang t\u00f4i cung c\u1ea5p v\u1edbi hy v\u1ecdng r\u1eb1ng ch\u00fang s\u1ebd h\u1eefu \u00edch, nh\u01b0ng xin l\u01b0u \u00fd r\u1eb1ng ch\u00fang t\u00f4i kh\u00f4ng th\u1ec3 \u0111\u1ea3m b\u1ea3o t\u00ednh ch\u00ednh x\u00e1c ho\u1eb7c t\u00ednh k\u1ecbp th\u1eddi c\u1ee7a c\u00e1c t\u00e0i li\u1ec7u \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef b\u00ean ngo\u00e0i.<\/p>\n<ul>\n<li><a href=\"http:\/\/docs.docker.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">T\u00e0i li\u1ec7u Docker<\/a><\/li>\n<li><a href=\"https:\/\/www.docker.com\/tryit\/\" target=\"_blank\" rel=\"noreferrer noopener\">H\u01b0\u1edbng d\u1eabn d\u00f9ng th\u1eed Docker<\/a><\/li>\n<li><a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Trung t\u00e2m Docker<\/a><\/li>\n<\/ul>\n<p>Ngu\u1ed3n: https:\/\/www.linode.com\/docs\/guides\/how-to-deploy-an-nginx-container-with-docker\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker Container l\u00e0 g\u00ec? Theo Docker.com, container l\u00e0 \u201cm\u1ed9t ph\u1ea7n m\u1ec1m nh\u1eb9, \u0111\u1ed9c l\u1eadp, c\u00f3 th\u1ec3 th\u1ef1c thi, bao g\u1ed3m m\u1ecdi th\u1ee9 c\u1ea7n thi\u1ebft \u0111\u1ec3 ch\u1ea1y n\u00f3: m\u00e3, th\u1eddi gian ch\u1ea1y, c\u00f4ng c\u1ee5 h\u1ec7 th\u1ed1ng, th\u01b0 vi\u1ec7n h\u1ec7 th\u1ed1ng v\u00e0 c\u00e0i \u0111\u1eb7t\u201d. Container c\u00f4 l\u1eadp ph\u1ea7n m\u1ec1m kh\u1ecfi m\u00f4i tr\u01b0\u1eddng xung quanh v\u00e0 \u0111\u01b0\u1ee3c t\u1ea1o<\/p>\n","protected":false},"author":1,"featured_media":36273,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[108],"tags":[],"class_list":["post-35044","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-containers"],"_links":{"self":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts\/35044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/comments?post=35044"}],"version-history":[{"count":0,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts\/35044\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/media\/36273"}],"wp:attachment":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/media?parent=35044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/categories?post=35044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/tags?post=35044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}