{"id":19443122,"url":"https://github.com/asizikov/docker-ubuntu-terraform","last_synced_at":"2026-05-17T05:37:50.275Z","repository":{"id":141789700,"uuid":"298374098","full_name":"asizikov/docker-ubuntu-terraform","owner":"asizikov","description":"This is a little demo which I prepared for a Cloud Engineering class. I never gave this training, so I just made it public.","archived":false,"fork":false,"pushed_at":"2020-09-24T19:22:26.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T08:15:15.630Z","etag":null,"topics":["docker","docker-image","docker-images"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asizikov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-24T19:18:24.000Z","updated_at":"2020-09-24T19:26:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"12f7e7eb-a8f0-431b-8cf9-ab8477d4c4e5","html_url":"https://github.com/asizikov/docker-ubuntu-terraform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/asizikov/docker-ubuntu-terraform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asizikov%2Fdocker-ubuntu-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asizikov%2Fdocker-ubuntu-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asizikov%2Fdocker-ubuntu-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asizikov%2Fdocker-ubuntu-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asizikov","download_url":"https://codeload.github.com/asizikov/docker-ubuntu-terraform/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asizikov%2Fdocker-ubuntu-terraform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33128724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"online","status_checked_at":"2026-05-17T02:00:05.366Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-image","docker-images"],"created_at":"2024-11-10T15:42:04.458Z","updated_at":"2026-05-17T05:37:50.236Z","avatar_url":"https://github.com/asizikov.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Building Docker image with installed Terraform.\r\n\r\nRun the latest `ubuntu` container:\r\n\r\n```bash\r\n docker container run -it --name ubuntu-latest ubuntu:latest /bin/bash\r\n```\r\n\r\nthen we need to download, unzip and install the latest version of terraform. Currently, the latest one is 0.13.3. \r\nMake sure to check it here:\r\n\r\nhttps://www.terraform.io/downloads.html\r\n\r\n\r\n\r\n```bash\r\napt-get update\r\napt-get install wget -y\r\napt-get install unzip -y\r\nwget https://releases.hashicorp.com/terraform/0.13.3/terraform_0.13.3_linux_amd64.zip\r\ncp terraform /usr/local/bin\r\nterraform --version\r\nexit\r\n ```\r\n\r\nNow we have installed terraform (as well as unzip and wget) and shut the container down.\r\n\r\n`docker ps -a` should confirm that\r\n\r\n```bash\r\ndocker ps -a                                                                                                                        \r\nCONTAINER ID        IMAGE               STATUS                                NAMES\r\n63016bcefec6        ubuntu:latest       Exited (0) About a minute ago         ubuntu-latest\r\n```\r\n\r\n`docker container diff ubuntu-latest` will print us all the changes applied to this container. If you want to read it though make yourself a cup of tea, it'll take a while.\r\n\r\nWe probably don't need all the changes, so let's do a little clean up:\r\n\r\n`docker start ubuntu-latest -a` to start the container and attach to it.\r\n\r\n```\r\n rm terraform\r\n rm terraform_0.13.3_linux_amd64.zip\r\n apt-get remove unzip -y\r\n apt-get remove wget -y\r\n exit\r\n```\r\n\r\nthis container is still going to have some changes due to the `apt-get update` call, but I'm ok with that.\r\n\r\nWhat's important is that we have (A)dded the terrafrom binary to its onwn place:\r\n\r\n```\r\nA /usr/local/bin/terraform\r\n```\r\n\r\nSo, it's time to commit the image:\r\n\r\n```bash\r\ndocker container commit -a \"@asizikov\" -m \"installed terraform 0.13.3\" \\\r\nubuntu-latest ubuntu-terraform\r\n```\r\n\r\n`docker images` should list all the images installed on your computer, and `ubuntu-terraform` should be among them.\r\n\r\nOk, it's time to tag and publish, I guess.\r\n\r\n```bash\r\ndocker image tag ubuntu-terraform:latest asizikov/ubuntu-terraform:0.13.3\r\ndocker push asizikov/ubuntu-terraform:0.13.3\r\n```\r\n\r\nIt's \r\n\r\n```\r\ndocker save asizikov/ubuntu-terraform:0.13.3 \u003e ubuntu-terraform.tar\r\nmkdir unpacked\r\ntar -xf ubuntu-terraform.tar -C unpacked\r\ncd unpacked\r\ntree\r\n```\r\n\r\nthis will produce a nice tree structure with all our layers:\r\n\r\n```\r\n├── 57f79de53e5eeff9c780866667a034a2b3959dc115b18f5cea5aec32b9677239.json\r\n├── 70b23ca3cba25ea431e904e2d4a90f144f52b907da5afee7e2e1a6004b9e3a35\r\n│   ├── VERSION\r\n│   ├── json\r\n│   └── layer.tar\r\n├── 7e08bf461d394ea068ee4836367cc46d4e1e47d9e848043c4b63a61b8c0e714a\r\n│   ├── VERSION\r\n│   ├── json\r\n│   └── layer.tar\r\n├── 8c91f14beadb4dcf4e11153514476e705521a0fbab80c27a1b582241a4f91b75\r\n│   ├── VERSION\r\n│   ├── json\r\n│   └── layer.tar\r\n├── 8e6ad6de8875a0658e8e86659248cdaa0d9de73b2132d94f685eb044115e1114\r\n│   ├── VERSION\r\n│   ├── json\r\n│   └── layer.tar\r\n├── manifest.json\r\n└── repositories\r\n```\r\n\r\nlet's find the latest layer:\r\n\r\n```bash\r\n$ cat repositories                                                          \r\n{\"asizikov/ubuntu-terraform\":{\"0.13.3\":\"8e6ad6de8875a0658e8e86659248cdaa0d9de73b2132d94f685eb044115e1114\"}}\r\n$ cd 8e6ad6de8875a0658e8e86659248cdaa0d9de73b2132d94f685eb044115e1114\r\n$ mkdir unpack_layer\r\n$ tar -xf layer.tar -C unpack_layer\r\n$ cd unpack_layer \r\n$ tree\r\n```\r\n\r\nThis will print the large tree with all the files which belong to the layer, and we can scroll all the way down to find our `terraform` executable. Lovely.\r\n\r\nMake sure to take a look there and think how can we make this image smaller.\r\n\r\n```\r\n.\r\n├── usr\r\n│   ├── bin\r\n│   ├── local\r\n│   │   ├── bin\r\n│   │   │   └── terraform\r\n```\r\n\r\nPS:\r\n\r\nDon't forget to clean things up:\r\n\r\n```\r\nrm -rf unpacked\r\nrm -f ubuntu-terraform.tar\r\ndocker container rm ubuntu-latest\r\ndocker image rm asizikov/ubuntu-terraform:0.13.3\r\n```\r\n\r\nThat's all folks! \r\nHappy dockering.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasizikov%2Fdocker-ubuntu-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasizikov%2Fdocker-ubuntu-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasizikov%2Fdocker-ubuntu-terraform/lists"}