--- 
canonical: 'https://mwop.net/blog/2024-09-20-docker-copy-to-host.html'
title: 'Copy A File From A Docker Container to the Host'
author: "[Matthew Weier O'Phinney](https://mwop.net)"
created: '2024-09-20T15:32:07-05:00'
updated: '2024-09-20T15:32:07-05:00'
tags:
  - docker
  - til

---
Occasionally, I want to get a file from a Docker container back to the host system.

First, you need to get the container ID; you can do this using `docker ps`.
Once you have that, use, `docker cp` as follows:

```bash
docker cp <containerId>:/path/to/file/in/container path/on/host
```




