<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Containerized Databases Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/containerized-databases/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/containerized-databases/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Fri, 24 May 2024 19:49:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>Containerized Databases Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/containerized-databases/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Setting Up PostgreSQL with Docker on Server Stadium Cloud VMs or Dedicated Servers</title>
		<link>https://serverstadium.com/knowledge-base/setting-up-postgresql-with-docker-on-server-stadium/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Fri, 24 May 2024 19:49:37 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=11953</guid>

					<description><![CDATA[<p>Introduction PostgreSQL is a powerful, open-source object-relational database system known for its robustness, scalability, and performance. Using Docker to deploy PostgreSQL can simplify the setup and maintenance of your database environment. This guide will walk you through setting up a PostgreSQL database using Docker on Server Stadium infrastructure. Prerequisites Access to a Server Stadium cloud&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/setting-up-postgresql-with-docker-on-server-stadium/">Setting Up PostgreSQL with Docker on Server Stadium Cloud VMs or Dedicated Servers</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Introduction</h3>
<p>PostgreSQL is a powerful, open-source object-relational database system known for its robustness, scalability, and performance. Using Docker to deploy PostgreSQL can simplify the setup and maintenance of your database environment. This guide will walk you through setting up a PostgreSQL database using Docker on Server Stadium infrastructure.</p>
<h3>Prerequisites</h3>
<ul>
<li>Access to a Server Stadium <a href="https://serverstadium.com/pricing/" target="_new" rel="noreferrer noopener">cloud VM</a> or <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noreferrer noopener">dedicated server</a> with Docker installed. If you need to install Docker, <a href="https://cp.serverstadium.com/regist-user" target="_new" rel="noreferrer noopener">sign up here</a> and refer to the official Docker page for installation instructions.</li>
<li>At least 2GB of RAM on your server for optimal performance.</li>
<li>Administrative or sudo privileges on your server.</li>
</ul>
<h3>Step 1: Pull the PostgreSQL Docker Image</h3>
<ol>
<li><strong>Download the PostgreSQL Image</strong><br />
Pull the latest PostgreSQL image from the Docker Hub: <div class="shortcode-code">
<p> docker pull postgres<br />
</p></div></li>
</ol>
<h3>Step 2: Run PostgreSQL in a Docker Container</h3>
<ol>
<li><strong>Start the PostgreSQL Container</strong><br />
Run a PostgreSQL container with a specified username, password, and database name: <div class="shortcode-code">
<p> docker run &#8211;name mypostgres -e POSTGRES_USER=myuser -e POSTGRES_PASSWORD=mypass -e POSTGRES_DB=mydb -p 5432:5432 -d postgres<br />
</p></div> This command sets environment variables for the user, password, and database, and maps port 5432 on the host to port 5432 in the container.</li>
</ol>
<h3>Step 3: Configure Persistent Data Storage</h3>
<ol>
<li><strong>Create a Docker Volume</strong><br />
To ensure data persistence across container restarts, create a Docker volume: <div class="shortcode-code">
<p> docker volume create pgdata<br />
</p></div></li>
<li><strong>Attach the Volume to the PostgreSQL Container</strong><br />
Start the PostgreSQL container with the volume attached: <div class="shortcode-code">
<p> docker run &#8211;name mypostgres -e POSTGRES_USER=myuser -e POSTGRES_PASSWORD=mypass -e POSTGRES_DB=mydb -p 5432:5432 -v pgdata:/var/lib/postgresql/data -d postgres<br />
</p></div></li>
</ol>
<h3>Step 4: Access and Manage the PostgreSQL Database</h3>
<ol>
<li><strong>Connect to the PostgreSQL Database</strong><br />
Connect to your PostgreSQL database using <code>psql</code> or any database management tool: <div class="shortcode-code">
<p> psql -h localhost -p 5432 -U myuser -d mydb<br />
</p></div> You will be prompted to enter the password specified earlier.</li>
</ol>
<h3>Step 5: Backup and Restore</h3>
<ol>
<li><strong>Backup the PostgreSQL Database</strong><br />
Backup your database using the <code>pg_dump</code> tool: <div class="shortcode-code">
<p> docker exec mypostgres pg_dump -U myuser mydb &gt; mydb_backup.sql<br />
</p></div></li>
<li><strong>Restore the PostgreSQL Database</strong><br />
Restore your database using <code>psql</code>: <div class="shortcode-code">
<p> cat mydb_backup.sql | docker exec -i mypostgres psql -U myuser -d mydb<br />
</p></div></li>
</ol>
<h3>Conclusion</h3>
<p>You have successfully set up a PostgreSQL database using Docker on your Server Stadium cloud VM or dedicated server. This setup not only ensures your data is managed efficiently but also leverages Docker for ease of deployment and scalability.</p>
<p>For more information on managing your PostgreSQL installation or other Docker-based applications, visit our <a href="https://serverstadium.com/knowledge-base/" target="_new" rel="noreferrer noopener">knowledge base</a> or consult the <a href="https://serverstadium.com/" target="_new" rel="noreferrer noopener">Server Stadium website</a>.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/setting-up-postgresql-with-docker-on-server-stadium/">Setting Up PostgreSQL with Docker on Server Stadium Cloud VMs or Dedicated Servers</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
