# How Do I Edit a File inside a Docker Container?

If you want to edit a file inside a docker container, you can follow these steps:

## 1. Find the id of the container

To find the id of the running container, you can use the following command:

```bash
docker container ls
```

The container id look something like this `8662ea2fa000`

## 2. Launch the shell inside the container

To launch the shell inside the container, use the following command

```bash
docker exec -u 0 -it 8662ea2fa000 /bin/bash
```

## 3. Edit the file

Now that you have access to containers shell, you can install your favorite editor and start editing.

To install nano editor, run the following command:

```bash
apt update
apt install nano
```

Then you can start editing like this:

```bash
nano /path/to/file
```
