{"id":511,"date":"2023-09-03T19:35:42","date_gmt":"2023-09-04T01:35:42","guid":{"rendered":"https:\/\/kop.lat\/blog\/?p=511"},"modified":"2023-09-03T21:31:42","modified_gmt":"2023-09-04T03:31:42","slug":"create-a-docker-image-from-a-local-os-linux-image","status":"publish","type":"post","link":"https:\/\/kop.lat\/blog\/create-a-docker-image-from-a-local-os-linux-image\/","title":{"rendered":"Create a Docker image from a local OS Linux Image"},"content":{"rendered":"\n<p>When working with docker, it always get the iamge fro mthe docker repo, but I wondered, what if I could just get a raw OS image and create my own, locally. Well, this is the process. <\/p>\n\n\n\n<p>Why? it&#8217;s FUN.<\/p>\n\n\n\n<p>1. Get the .xyz image from <\/p>\n\n\n\n<p><a href=\"https:\/\/fedoraproject.org\/cloud\/download\/](Fedora\">https:\/\/fedoraproject.org\/cloud\/download\/<\/a> (ussually the &#8220;Fedora Cloud 38 Raw raw.xz&#8221;)<\/p>\n\n\n\n<p>2. tools installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install qemu-utils libguestfs-tools<\/code><\/pre>\n\n\n\n<p>3. Extract the raw image:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unxz Fedora-Cloud-Base-38-1.6.x86_64.raw.xz<\/code><\/pre>\n\n\n\n<p>4. Generate the tar.gz<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>virt-tar-out -a Fedora-Cloud-Base-38-1.6.x86_64.raw \/ - | gzip &gt; f38.tar.gz<\/code><\/pre>\n\n\n\n<p>5. Create the docker image with the tag<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker import f38.tar.gz f38x:latest<\/code><\/pre>\n\n\n\n<p>6. Create the container<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -it --name app1 f38x \/bin\/bash<\/code><\/pre>\n\n\n\n<p>7. Create the app<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker start app1<\/code><\/pre>\n\n\n\n<p>8. Execute the container<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker exec -it app1 \/bin\/bash<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with docker, it always get the iamge fro mthe docker repo, but I wondered, what if I could just get a raw OS image and create my own, locally. Well, this is the process. Why? it&#8217;s FUN. 1. Get the .xyz image from https:\/\/fedoraproject.org\/cloud\/download\/ (ussually the &#8220;Fedora Cloud 38 Raw raw.xz&#8221;) 2. tools [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":468,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[47,46,4,8,77],"tags":[73,70,81,5,82,80,79,22,78],"_links":{"self":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts\/511"}],"collection":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/comments?post=511"}],"version-history":[{"count":2,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":514,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions\/514"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/media\/468"}],"wp:attachment":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/media?parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/categories?post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/tags?post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}