Quick question: Is it possible to create new containers on error? I know that when a container exits we can restart it (given the correct parameter) but instead of a restart I would like to recreate because I don’t want to maintain the state that was on the container. Any help is appreciated. Thanks!
Is it possible to create new containers on error?
461 Views Asked by Manuel At
2
There are 2 best solutions below
0
j3ko
On
It might not be ideal but you can have the docker container set to --restart=no and an external cron job set to run something like:
docker inspect --format '{{json .State.Running}}' container-name
If it comes back false, manually run the commands to recreate the container, something like:
docker-compose rm container-name
docker-compose up -d container-name
Related Questions in DOCKER
- sqlplus myusername/mypassword@ORCL not working with Oracle on Docker
- Golang == Error: OCI runtime create failed: unable to start container process: exec: "./bin": stat ./bin: no such file or directory: unknown
- Only the first SQL script gets executed inside Docker Postgres container
- Retrieve the Dockerfile configuration from the Kubernetes and also change container Java parameter?
- Polars with Rust: Out of Memory Error when Processing Large Dataset in Docker Using Streaming
- Compiling eBPF program in Docker fails due to missing '__u64' type
- AttributeError: module 'numba' has no attribute 'generated_jit'
- Phoenix in a docker dev environment - generated code can't be saved from VSCode
- Docker on Multipass VMs: Connecting worker nodes to swarm results in rcp error
- Facing error in creating image of my react+vite project . Dockerfile error
- NextJS Docker build fails: fetch failed ECONNREFUSED
- Docker container unable to make HTTPS requests to external API
- Failed to connect to your instance after deploying mern app on aws ec2 instance when i try to access frontend
- Connecting to Postgres running in a Docker container using psql
- Can't connect to local postgresql server from my docker container
Related Questions in DOCKER-COMPOSE
- Only the first SQL script gets executed inside Docker Postgres container
- Phoenix in a docker dev environment - generated code can't be saved from VSCode
- NextJS Docker build fails: fetch failed ECONNREFUSED
- Failed to connect to your instance after deploying mern app on aws ec2 instance when i try to access frontend
- Passing arguments to ENTRYPOINT causes the container to start and run indefinitely
- Why docker-compose volume binding didn't work during the build? Should I always COPY necessary for build files?
- docker-compose can't reset postgresql database
- mySQL through docker compose not available at localhost
- Problem running wagtail(CMS for django) and postgresql in Docker Compose
- Docker: keep python packages consistent
- How to create a docker composer environment where containers can communicate each other?
- Error: P1001: Can't reach database server at `db`:`5432` on github actions
- Springboot Kafka Consumer unable to maintain connect to kafka cluster brokers
- Nodejs application cannot communicate with postgresql (docker-compose)
- Issues with redirect when setting up Traefik Reverse Proxy in Docker
Related Questions in CONTAINERS
- AttributeError: module 'numba' has no attribute 'generated_jit'
- Docker container does not find System Daemon of nordvpn after reboot
- How container isolation is being achieved for windows containers which use process isolation mode?
- Installing dotnet8 on amazonlinux 2023 image through dockerfile
- Mount Azure file share on Azure container app
- Spring Boot application container memory footprint (Java 21)
- Error initializing a docker container after installing transmission-daemon and nordvpn
- How to ping IPv6 address of link-local from container attached to bridge network
- C++ ordered map optimized with index access
- How to run a script after mysql container initialization?
- Azure Form Intelligence Connected Container performance
- Attaching a debugger to a container/instance running on a K8s Pod?
- Connecting Azure container app Spring boot backend to Azure container app Neo4j database
- Visual Studio 2022 free certificate problem. "cannot import key file " how to fix
- Open VS code from terminal in devcontainer?
Related Questions in STATE
- NextJS 13 14, Store server state globally
- My state is undefined despite being setted
- Next.js carousel component loads instagram basic display api perfectly except in Safari browser
- How can I create a javascript animation that recognizes when it hits things, in other words a hit box?
- Flutter - When an element is deleted from the ListView, the state of the element under deletion is reset
- State Transfer from a model using Riverpod flutter
- React components don't re render when the state is changed
- Flutter | Persisting Navigator State Using Hydrated Bloc with the Bloc Design Pattern
- Wait set state finishes to call another function
- keyboard focus with GTK4 Rust does not work as expected and how to get state
- Bind state to context value in React JS
- I have a problem when I run on the web Bad state: databaseFactory not initialized databaseFactory
- How to manage state in a chrome extension in this scenario
- Should I use immutable or mutable state for a JSON tree editor in Flutter?
- React Component doesn't change states until file is resaved, then runs both at same time
Related Questions in RECREATE
- Recreating bar chart with R and ggplot2
- Uanble to recreate built-in posterior() in R Toy example provided
- Kotlin app using recreate() function Error:"java.lang.IllegalStateException: Must be called from main thread"
- Restore or some recreate a tablespace to another new tablespace on the side or empty db with only
- recreate activity with animation not work
- Android ActivityInjector: get life cycle exception after language change
- OnPause called after OnResume after calling recreate
- Re deploy Azure Virtual Machine
- TextInputLayout hint doesn't get refreshed upon recreate() method call
- how to change language at run time with out recreating activity
- How to call recreate from another class in Kotlin?
- Why is recommended to recreate the whole database schema for each test?
- Is it possible to create new containers on error?
- Is there a way to recreate the "parent" class from a static class?
- Fragment not visible after when activity is recreated
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Basically when you run a docker image, it get run into a docker container. It's kind of an abstraction. So If you want to recreate the container then just run the image again.
To run a container you just need to provide the image that it uses:
docker run <docker_image>One thing is need to remember, if you use the same docker image to create multiple docker container then all of them will function same, so if you want different function then you need to create new docker image and then run that image.