Skip to content

Instantly share code, notes, and snippets.

@svanellewee
Last active December 26, 2015 21:08
Show Gist options
  • Select an option

  • Save svanellewee/76aa3d54179f5bd4e45a to your computer and use it in GitHub Desktop.

Select an option

Save svanellewee/76aa3d54179f5bd4e45a to your computer and use it in GitHub Desktop.
Docker Postgres Hackery
create table Birds (idBirds SERIAL, Name varchar(11));
insert into Birds (Name) values ('Hadida'),('Dikkop');
# the image should do the -v part already... not sure why the below -v is required.
# assume the parent /var/lib/postgresql/data was already created.
sudo docker run -e POSTGRES_PASSWORD=root -e POSTGRES_USER=root -e PGDATA=/var/lib/postgresql/data -v /var/lib/postgresql/data:/var/lib/postgresql/data -d postgres:9.4
# cid=$(start_docker_postgres.sh)
# sudo docker exec -it $cid /bin/bash
# createdb bla
# psql bla
# do some sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment