LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 10-07-2021, 10:25 AM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Question Difference between --restart=always Vs having .service file restart container with Podman?


Just wondering if anyone has any insight having the --restart-always command when launching a container from an image Vs creating a .service file to restart a container, say if server is rebooted?

Are there any pros or cons with either or?

Here is an example of the --restart=always command
Code:
[matt@localhost ~]$ podman run -d --name registry -p 5000:5000 -v "$(pwd)"/certs:/certs  --restart=always -e REGISTRY_HTTP_ADDR=0.0.0.0:5000 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key --privileged registry:2
Reference from this blog:

https://snyk.io/blog/privileged-docker-containers/

Vs.

Using .service file to restart a container:

https://www.tutorialworks.com/podman-systemd/
 
Old 10-07-2021, 05:19 PM   #2
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
When I was first learning Docker I had no concept of the --restart toggle so I made systemd services for each of my containers. Over my reading I found it to be more about best practices to use as few external as possible? That and in the case of --restart it will work whether or not the host uses systemd. Else you'd need to provide an init script or whatever. Thus far I have 5 dockers running on the server at any given time. The only one with a systemd service at this point just fires a 15 second countdown + notification in game then stops the minecraft server gracefully on system shutdown.

Last edited by jmgibson1981; 10-07-2021 at 05:42 PM.
 
  


Reply

Tags
.service, podman



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Podman Tutorial – Get Started With Podman LXer Syndicated Linux News 0 08-06-2021 11:39 PM
LXer: What Is Podman And How To Install Podman In Linux LXer Syndicated Linux News 0 08-01-2021 03:03 AM
LXer: Configuring container networking with Podman LXer Syndicated Linux News 0 10-28-2019 08:36 PM
LXer: Red Hat Advances Container Technology With Podman 1.0 LXer Syndicated Linux News 0 01-20-2019 05:42 PM
what is the difference between service network reload and service network restart ? markraem Linux - Networking 3 11-21-2007 03:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 03:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration