0

I have docker compose file:

  x11:
    network_mode: host
    container_name: x11
    image: dorowu/ubuntu-desktop-lxde-vnc
    restart: on-failure
    environment:
      - RESOLUTION=1920x1080

  my_app:
      network_mode: host
      container_name: my_app
      image: my-image-path
      restart: on-failure
      depends_on:
        - x11
      environment:
        - LANG=ru_RU.UTF-8
        - DISPLAY=:1
      entrypoint:
        ./start_script

Sometimes, during my tests my application crashes. And because I have option "restart: on-failure" it automatically restarts. The problem is that the state of the application is saved at the time of the crash, for example some windows remain open. Is there a way to delete the data in the container on restart or make it so that a new container is created each time?

Ivan
  • 163
  • 7

1 Answers1

1

So far, it is not possible to do that automatically (I mean in docker-compose.yaml). You will need to rely on something external for enforcing like create a bash script that automatically removes containers as shown here. However, you still need to link it up with your app on failure.

Fadi
  • 585
  • 4
  • 22