728x90
반응형
How to ubuntu with docker container
1. Pull the Ubuntu image from Docker Hub.
docker pull ubuntu
2. Create a new container based on the Ubuntu image.
docker run -it ubuntu
3. Access the Ubuntu container.
docker attach ubuntu
4. Perform your desired tasks within the Ubuntu container.
5. Stop the Ubuntu container.
docker stop ubuntu
6. Remove the Ubuntu container.
docker rm ubuntu
Run a Docker container based on the "anti1346/ubuntu2204:systemd" image, open an interactive session using a Bash shell inside the container, and automatically destroy the container after shutdown.
docker run -it --rm anti1346/ubuntu2204:systemd bash
Let's break down the command:
- "docker run" starts a new Docker container.
- "-it" attaches an interactive terminal to the container.
- "--rm" specifies that the container should be automatically removed after it exits.
- "anti1346/ubuntu2204:systemd" is the name of the Docker image used for the container. In this case, it is an Ubuntu 22.04 image with systemd.
- "bash" specifies the command to run inside the container. In this case, it launches the Bash shell.
728x90
반응형
'Linux Distributions' 카테고리의 다른 글
How to install the latest version of influxdb on Ubuntu (0) | 2023.06.21 |
---|---|
How to install and configure chrony (0) | 2023.06.20 |
How to set or change timezone on Ubuntu (0) | 2023.06.19 |
How to Install SSH Server on Ubuntu (0) | 2023.06.16 |
How to install Apache from source code on CentOS 7 and enable HTTP/2 (0) | 2023.06.15 |