Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

373
Visualizações
protect docker container and\or volume from accidental deletion

we have a docker container (mongodb) we are using, with volume mount to store data persistently.

I would like to protect the container and\or volume from accidental deletion by commands 'docker volume prune' or even just 'docker volume rm'

any suggestion?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

To prevent accidental deletion of container/volume, there is no any in-built way provided by docker for it.

Check this out.

Also there was a code change to have this feature as mentioned here but it was voted against by solomon hykes because of few reasons.


But there is way to prevent accidental volume deletion while using docker volume prune.

Check this out.

Hope this helps.

over 4 years ago · Santiago Trujillo Relatório

0

Create a function / alias in the bash profile or bashrc.

function docker {
  docker_vol_res="Y"
  [[ $1 == vol* ]] && [[ $2 == prune || $2 == rm ]] && echo -n "Do you want to \"$2\" the volume (Y/N)? " && read docker_vol_res
  [[ $docker_vol_res == "Y" ]] && /usr/bin/docker $*
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda