I am able to run a docker container using following docker command:
docker run -it ubuntu /bin/bash
Now I am trying to do it by using docker-compose:
version: "3"
services:
ubuntu:
container_name: ubuntu
image: ubuntu
restart: on-failure
command: "/bin/bash"
Now when I do :
docker-compose up -d
Can see docker container starting and exiting immediately.
I tried looking at the logs :
docker logs b8 //b8 is container id
But there are no error logs.
How do I keep ubuntu container running in background using docker. ( I am using docker on windows , linux version)
while true sleepubuntuimage, or to have just a shell be the main container process. Generally you’d package up an application (or one piece like a database or a REST API) in a custom image, and have its default CMD in the Dockerfile run the application.