{"id":4435,"date":"2022-10-10T20:36:22","date_gmt":"2022-10-10T20:36:22","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=4435"},"modified":"2022-10-10T20:36:22","modified_gmt":"2022-10-10T20:36:22","slug":"postgresql-in-docker","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/postgresql-in-docker\/","title":{"rendered":"Postgresql in Docker"},"content":{"rendered":"<p>Let&#8217;s run up the Docker image with an instance of PostgreSQL<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\ndocker run --name mypostgres -d postgres\r\n<\/pre>\n<p>Now, connect to the instance so we can create a database etc.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\ndocker exec -it mypostgres bash\r\n<\/pre>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\ncreatedb -U postgres MyDatabase\r\n<\/pre>\n<p><em>Note: if you find this error message <strong>psql: FATAL:  role &#8220;root&#8221; does not exist<\/strong>, you&#8217;ll need to switch to the postgres user, see below.<\/em><\/p>\n<p>Switch to the postgres user (<em>su<\/em> substitute user).<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nsu postgres\r\npsql\r\n<\/pre>\n<p>At which point, we&#8217;re now in the psql application and can create databases etc. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s run up the Docker image with an instance of PostgreSQL docker run &#8211;name mypostgres -d postgres Now, connect to the instance so we can create a database etc. docker exec -it mypostgres bash createdb -U postgres MyDatabase Note: if you find this error message psql: FATAL: role &#8220;root&#8221; does not exist, you&#8217;ll need to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[102,145,140],"tags":[],"class_list":["post-4435","post","type-post","status-publish","format-standard","hentry","category-docker","category-postgresql","category-ubuntu"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/4435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=4435"}],"version-history":[{"count":4,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/4435\/revisions"}],"predecessor-version":[{"id":4439,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/4435\/revisions\/4439"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=4435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=4435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=4435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}