Dino Geek, try to help you

What is the difference between Docker run exec and attach?


Docker run, exec, and attach are three separate commands used in managing Docker containers. Here are the differences:

1. Docker run: This command is used to start a new Docker container. With `docker run`, you specify the image you want to use, pass any necessary parameters or environment variables, and it will start a new container based on that image for you. For instance, “docker run ubuntu” will start a new container using the Ubuntu image.

1. Docker exec: This command is used to run a new command in a running Docker container. You specify the Docker container you want to interact with and the command you want to run inside it. For example, “docker exec my\_container ls” would run the `ls` command inside the `my_container` Docker container.

1. Docker attach: This command is used to attach your terminal’s input, output, and error messages to a running Docker container, almost as if you were ssh-ing into it. This allows you to interact with a running Docker container as if it was a separate system. When you’re done, you detach your terminal from the Docker container without stopping it.

Keep in mind that while `docker exec` and `docker attach` may sometimes appear to do similar things, `docker exec` runs a new command in a container, while `docker attach` hooks you into the existing main process of the container. If that process ends, so will your session with the container.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use