# How to enter a Docker container already running with a new TTY?

To enter a Docker container already running with a new TTY, you can use the `docker exec` command. Here's an example:

```bash
docker exec -it <container_id_or_name> sh
```

Replace `<container_id_or_name>` with the ID or name of the container you want to enter. The `-it` option tells Docker to allocate a new TTY for the container and run a shell inside the container.

In this example, the `sh` command is used to start a shell inside the container. Depending on the operating system and software installed in the container, you may need to use a different command to start a shell. For example, on an Ubuntu-based container, you can use `bash` instead of `sh`.

Once you run this command, you should see a prompt that looks similar to the following:

```bash
root@<container_id_or_name>:/#
```

This indicates that you are now inside the container and can run commands as if you were logged in to the container directly. When you are done working inside the container, you can exit the shell by running the `exit` command. This will return you to the host machine's shell.