-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Description
Step 1: Pull the Ubuntu Docker Image
Open your terminal and run:
docker pull ubuntuStep 2: Run the Container with a Sleep Command
Now, run the container in detached mode (-d) and use a command to keep it alive. We'll use sleep to make it sleep indefinitely:
docker run -d --name my-ubuntu-container ubuntu sleep infinityStep 3: Access the Running Container
Once the container is running, you can access it using:
docker exec -it my-ubuntu-container bashSummary of Commands
-
Pull the Ubuntu image:
docker pull ubuntu
-
Run the container with a sleep command:
docker run -d --name my-ubuntu-container ubuntu sleep infinity
-
Bash into the running container:
docker exec -it my-ubuntu-container bash
Optional: Stopping and Removing the Container
-
To stop the container:
docker stop my-ubuntu-container
-
To remove the container:
docker rm my-ubuntu-container
That’s it! You should now have a running Ubuntu container that will not crash. Let me know if you have any questions!
Metadata
Metadata
Assignees
Labels
No labels