1. 2. 3. 1. Stack Overflow About Products For Teams Log in Sign up 2. Join Stack Overflow to learn, share knowledge, and build your career. Sign up with email Sign up with Google Sign up with GitHub Sign up with Facebook 1. Home 2. 1. 2. PUBLIC Questions 3. Tags 4. Users 5. 6. 7. COLLECTIVES Explore Collectives FIND A JOB 8. Jobs 9. Companies 3. TEAMS Stack Overflow for Teams – Collaborate and share knowledge with a private group. Create a free Team What is Teams? Docker: How to extract the Docker image into local system Ask Question Asked 3 years, 5 months ago Active 4 months ago Viewed 28k times 12 5 I want to extract the Docker image (from Ubuntu server) into my local system (Linux machine). I run the following command docker exec -it containername_or_ID /bin/bash I am able to view image by using this command, but I am unable to get this image into my local system. linuxdocker Share Follow edited Dec 11 2020 at 0:53 Promise Preston 14.3k99 gold badges8181 silver badges102102 bronze badges asked Sep 11 2018 at 9:18 arun kamboj 96533 gold badges1616 silver badges4242 bronze badges If you want to get the image on your other machine and don't want to build it again then the ideal way is push the docker image created on your Ubuntu server to docker hub repository. Then you can simply do the docker pull to pull the image at any machine. – Mahattam Sep 11 2018 at 11:13 Add a comment 3 Answers ActiveOldestScore 22 It depends though on what you're actually asking for. You are talking about extracting the image, but you're referring to an existing container. While jbrownwrld's answer is right in your context, if you want to extract an image, you can use docker save for that. Identify the image using: docker image ls mariadb 10.3-bionic 92744546933d 4 days ago 343MB Then output the tar file (default format): docker save mariadb:10.3-bionic --output mariadb.tar mkdir mariadb && mv mariadb.tar mariadb && cd mariadb && tar xvf mariadb.tar There are lots of files and folders being extracted, so you had better use another directory. The folders generally correspond to the image layers. Share Follow edited Sep 21 2019 at 0:37 answered Sep 17 2019 at 13:21 Lethargos 41233 silver badges1010 bronze badges Using your approach I've found then inside the extracted image there's a layer.tar directory which can then be extracted again and then I got the output similar to docker export. – Juraj Martinka Mar 18 2020 at 8:58 1 @JurajMartinka, but you don't need to create a container to extract, you can achieve this on plain image. – stck Nov 16 2020 at 7:31 1 The issue with docker save is that the saved tar has all layers as separate additional layer.tar files inside the tar. Using docker export gives you all of them combined together. – Mitar Aug 22 2021 at 12:05 Well, yeah, it depends on what you're looking for. That could be helpful in certain situations. – Lethargos Aug 22 2021 at 16:36 Add a comment 21 You can use docker's export tool for this. docker export will output the contents of a container into a .tar file; $ docker export container_name > output.tar See the docker docs for more information: https://docs.docker.com/engine/reference/commandline/export/ Share Follow answered Sep 11 2018 at 9:24 jbrownwrld 34111 silver badge55 bronze badges Add a comment 3 In order to extract image contents without dealing with many layers, a container should be created first. If docker run was already run, use that container, otherwise create a stopped container with docker create. Then use docker export or docker cp. id=$(docker create image:tag) docker export $id -o image.tar docker rm $id Share Follow answered Oct 6 2021 at 16:46 Konstantin Pelepelin 1,00011 gold badge1111 silver badges2525 bronze badges Add a comment Your Answer Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Required, but never shown Post Your Answer By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy Not the answer you're looking for? Browse other questions tagged linux docker or ask your own question. The Overflow Blog Gen Z doesn’t understand file structures (Ep. 415) Column by your name: The analytics database that skips the rows Featured on Meta Planned maintenance scheduled for Saturday, February 19, 2022 at 2:00AM UTC... Update on the ongoing DDoS attacks and blocking Tor exit nodes New official secondary domain: stackoverflow.co Linked -1 How to extract project code from docker to local system Related 4126 How is Docker different from a virtual machine? 1828 How to get a Docker container's IP address from the host 1039 How to deal with persistent storage (e.g. databases) in Docker 870 Exploring Docker container's file system 2082 How to copy files from host to Docker container? 2432 From inside of a Docker container, how do I connect to the localhost of the machine? 1610 How do I get into a Docker container's shell? 1218 How to force Docker for a clean build of an image 487 How to use local docker images with Minikube? 716 How to fix docker: Got permission denied issue Hot Network Questions Would it be possible for a society to construct islands? Intuitive reason for an approximation to x! How can I remove a dead animal stuck inside an underground stormwater drain pipe? How could people in the medieval times defeat an armored vehicle? Fantasy movie/series about a guy with magical returning sword Algorithm for compressing a stream of 12-bit ADC data in a Cortex M0 microcontroller Indistinguishability of symmetric encryption under CCA Ctrl-Alt-Del equivalent on Linux? How many matchstick moves to change a number? When and why should we choose rounded corners over smooth corners? How is asteroidal rock formed? Problems with students stuck in web-browser and what to do about it If force depends only on mass and acceleration, how come faster objects deal more damage? What is the chord played by 1-6-1? Trying to ID an 80's scifi movie what take place on an alien planet with a giant volcano "Dumb" log-loss for a binary classifier Latinism to say "everyone knows" Is it recommended to change root directory permission to improve security? SQL Server sample database WideWorldImporters fails dbcc checkdb Why is Philoktetes specifically hunting "doves"? Logistic population equation and exponential model What were the speeds of Pioneer 10 and Voyager 1 when Voyager overtook it in 1998? What does "the Buckeye" mean in this context? Can a power transformer cause building vibration Question feed STACK OVERFLOW Questions Jobs Developer Jobs Directory Salary Calculator Help Mobile Disable Responsiveness PRODUCTS Teams Talent Advertising Enterprise COMPANY About Press Work Here Legal Privacy Policy Terms of Service Contact Us Cookie Settings Cookie Policy STACK EXCHANGE NETWORK Technology Culture & recreation Life & arts Science Professional Business API Data Blog Facebook Twitter LinkedIn Instagram site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.2.16.41461