Disable/delete Docker container marked with Restart: Always

Asked

Viewed 104 times

0

I started a service on Docker with the image of the db icon, follow Docker:

version: "3.1"
services:
  mongo:
    image: 'mongo'
    container_name: mongoapp
    restart: always
    image: mongo
    volumes:
      - ./data/db:/data/db
    ports:
      - "27017:27017"

It worked perfectly, every time I start Ocker the container is there. But this container doesn’t matter anymore and I want to disable/ delete/ remove/ kill it, and no matter how many times you delete it or delete your image Docker goes up the service again. How to remove this container?

2 answers

0

The solution I found was to erase everything on Docker:

sudo docker stop $(sudo docker ps -a -q) && sudo docker rm $(sudo docker ps -a -q) && sudo docker image rm $(sudo docker image ls -a -q) --force

This erased ALL literally but magically the image of Mongo and the container is initialized again

-2

The question is old, but maybe it still helps someone.

Utilize docker-compose down that will work.

Att.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.