{"action":"created","issue":{"url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5","repository_url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp","labels_url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5/comments","events_url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5/events","html_url":"https://github.com/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5","id":184158157,"number":5,"title":"Using Docker Compose","user":{"login":"jhallam3","id":5174328,"avatar_url":"https://avatars.githubusercontent.com/u/5174328?v=3","gravatar_id":"","url":"https://api.github.com/users/jhallam3","html_url":"https://github.com/jhallam3","followers_url":"https://api.github.com/users/jhallam3/followers","following_url":"https://api.github.com/users/jhallam3/following{/other_user}","gists_url":"https://api.github.com/users/jhallam3/gists{/gist_id}","starred_url":"https://api.github.com/users/jhallam3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhallam3/subscriptions","organizations_url":"https://api.github.com/users/jhallam3/orgs","repos_url":"https://api.github.com/users/jhallam3/repos","events_url":"https://api.github.com/users/jhallam3/events{/privacy}","received_events_url":"https://api.github.com/users/jhallam3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-20T07:52:02Z","updated_at":"2016-10-25T18:15:07Z","closed_at":null,"body":"Hi, When I follow both your Pluralsight training and your code. I cant seam to get it to build the docker images. \r\nIve set the connection string to \r\n            var connectionString = \"User ID=postgres;Password=password;Server=localhost;Port=5432;Database=postgres;Integrated Security=true;Pooling=true;\";\r\n\r\nthen doing a docker build \r\n\r\ndocker build -f core.development.dockerfile -t Username/core:latest .\r\n\r\nit errors with \r\n\r\nAn error occurred while calling method 'ConfigureServices' on startup class 'Core.Startup'. Consider using IDbContextFactory to o\r\nverride the initialization of the DbContext at design-time. \r\n\r\nError: Connection refused   \r\nSystem.Net.Sockets.SocketException: Connection refused                                                                           \r\n   at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout)                                                                      \r\n   at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout)                                                                      \r\n   at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)                                                                         \r\n   at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout)                                                \r\n   at Npgsql.NpgsqlConnection.OpenInternal()                                                                                     \r\n   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()                                                          \r\n   at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlDatabaseCreator.Exists()                                              \r\n   at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()                                                        \r\n   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)                                 \r\n   at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)       \r\n   at Microsoft.EntityFrameworkCore.Tools.Cli.DatabaseUpdateCommand.<>c__DisplayClass0_0.<Configure>b__0()                       \r\n   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)                                        \r\n   at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)                                                        \r\nConnection refused      \r\n\r\nthe solution runs fine its now getting it to build in to docker. \r\n\r\nMy docker file is below. \r\n\r\nFROM microsoft/dotnet:latest\r\n\r\nMAINTAINER Jon Hallam\r\n\r\nENV DOTNET_USE_POLLING_FILE_WATCHER=1\r\n\r\nCOPY . /app\r\n#COPY ./package.json /var/www/aspnetcoreapp/package.json\r\n\r\nWORKDIR /app\r\n\r\nRUN dotnet restore\r\n\r\nRUN dotnet build\r\n\r\nEXPOSE 5000/tcp\r\n\r\nRUN [\"dotnet\", \"ef\", \"database\", \"update\"]\r\n\r\n#ENTRYPOINT [\"dotnet\", \"watch\", \"run\", \"--server.urls\", \"http://0.0.0.0:5000\"]\r\n\r\n\r\nENTRYPOINT [\"dotnet\", \"run\", \"--server.urls\", \"http://0.0.0.0:5000\"]\r\n\r\n\r\n# Build the image:\r\n# docker build -f core.development.dockerfile -t username/core:latest .\r\n\r\n# Option 1\r\n# Start PostgreSQL and ASP.NET Core (link ASP.NET core to ProgreSQL container with legacy linking)\r\n \r\n# docker run -d --name my-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password postgres\r\n# docker run -d -p 5000:5000 --link my-postgres:postgres username/core:latest\r\n\r\n# Option 2: Create a custom bridge network and add containers into it\r\n\r\n# docker network create --driver bridge isolated_network\r\n# docker run -d --net=isolated_network --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=password postgres\r\n# docker run -d --net=isolated_network --name aspnetcoreapp -p 5000:5000 username/core:latest\r\n\r\n\r\nbasically I have Migrations that works great in dev however getting it to deploy migrations when its deployed to docker with postgres it fails. "},"comment":{"url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/comments/256117458","html_url":"https://github.com/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5#issuecomment-256117458","issue_url":"https://api.github.com/repos/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5","id":256117458,"user":{"login":"jhallam3","id":5174328,"avatar_url":"https://avatars.githubusercontent.com/u/5174328?v=3","gravatar_id":"","url":"https://api.github.com/users/jhallam3","html_url":"https://github.com/jhallam3","followers_url":"https://api.github.com/users/jhallam3/followers","following_url":"https://api.github.com/users/jhallam3/following{/other_user}","gists_url":"https://api.github.com/users/jhallam3/gists{/gist_id}","starred_url":"https://api.github.com/users/jhallam3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhallam3/subscriptions","organizations_url":"https://api.github.com/users/jhallam3/orgs","repos_url":"https://api.github.com/users/jhallam3/repos","events_url":"https://api.github.com/users/jhallam3/events{/privacy}","received_events_url":"https://api.github.com/users/jhallam3/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T18:15:07Z","updated_at":"2016-10-25T18:15:07Z","body":"I use dock compose with the dockerfile you have as a example. That works\nwell.\n\nI have it working now. It was migrations not applying on startup.\n\nAlso is there a way of having two connection string for different\nenvironments? At the mo I change to localhost and Postgres in two locations\nthe app.setting and the applicationdbcontext. Just trying to be more\nproductive.  :)\n\nThanks for a great example having that has been a god send!\n\n\n\nRegards\n\nJon Hallam\n\n\nOn 20 Oct 2016, at 17:22, Dan Wahlin <notifications@github.com> wrote:\n\nWhile you can individually build the images, I'm going to recommend using\nDocker Compose for that. That's why it's there - to simplify that process.\nThe other option is there mainly to show that it's possible to build\nindividual images, link them, etc. but I never use that option as it's not\nproductive. Docker Compose handles it...have you tried that?\n\n—\nYou are receiving this because you authored the thread.\nReply to this email directly, view it on GitHub\n<https://github.com/DanWahlin/AspNetCorePostgreSQLDockerApp/issues/5#issuecomment-255155274>,\nor mute the thread\n<https://github.com/notifications/unsubscribe-auth/AE70OLnjUxv16kf24zkh0YecUbeqVXCAks5q15UmgaJpZM4Kb0b3>\n.\n"}}
{"actor":{"display_login":"jhallam3"}}