{
    "componentChunkName": "component---src-templates-docs-js",
    "path": "/vecka6-drift/just-task-it-docker-compose",
    "result": {"data":{"site":{"siteMetadata":{"title":"Linnéuniversitetet","language":"sv","courseCode":"1DV613"}},"mdx":{"fields":{"id":"757a011f-e66d-51e4-9651-0a399a428f1f","title":"JTI - Docker Compose","slug":"/vecka6-drift/just-task-it-docker-compose"},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"JTI - Docker Compose\",\n  \"metaTitle\": \"1dv613 | vecka 6 | JTI - Docker Compose\",\n  \"metaDescription\": \"metaDescription\",\n  \"order\": 7\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", null, \"Goals\"), mdx(\"p\", null, \"The goal of this exercise is to build upon \\\"JTI - Docker\\\" by incorporating Docker Compose to orchestrate your Docker containers. Once completed, you'll be able to work on your application locally, but through Docker containers.\"), mdx(\"h2\", null, \"Prerequisites\"), mdx(\"p\", null, \"By now, you should have completed the first step, \\\"1. JTI - Docker\\\". You can continue to work in the same repository if you prefer.\"), mdx(\"p\", null, \"Ensure you watch Demo #5 during this exercise.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, mdx(\"em\", {\n    parentName: \"strong\"\n  }, \"Important: Stop and remove the containers and images created during the previous exercise.\"))), mdx(\"h2\", null, \"1. Docker Compose\"), mdx(\"p\", null, \"Follow the guide (Demo #5), keeping the following in mind:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Your aim is to mount a volume between your local \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"src\"), \" folder and the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"src\"), \" folder in the container, similar to the previous exercise. However, it should be done in a generic way so that the path is not dependent on your local operating system.\")), mdx(\"p\", null, \"Here are some tips and things to note:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"When using \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"volumes\"), \" in the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"docker-compose.yaml\"), \" file, you can write relative paths, e.g., \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"./src:/usr/src/app/src\"), \".\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Create a volume for MongoDB as well. See the \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://hub.docker.com/_/mongo\"\n  }, \"official MongoDB image \", mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"mongo\"), \" on Docker Hub\"), \" for more information. Place the volume in your repository under \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \".volumes/mongodb\"), \" and add \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \".volumes\"), \" to your \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \".gitignore\"), \" file.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"With Docker Compose, you don't need to specify networks. Docker Compose will automatically create one for you.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"For convenience, add the line \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"\\\"docker:dev\\\": \\\"docker compose up --build\\\"\"), \", to your \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"scripts\"), \" section in \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"package.json\"), \". This allows you to start easily with: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"npm run docker:dev\"), \".\")), mdx(\"h3\", null, \"Test it!\"), mdx(\"p\", null, \"Open your web browser and visit \", \"[http://localhost:8080]\", \". The application should be up and running.\"), mdx(\"p\", null, \"You should now be able to modify files in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"src\"), \" folder on your local machine. nodemon in the container will detect these changes and restart the application. Refresh your browser to confirm that changes to the front page are visible.\"), mdx(\"h2\", null, \"Next step\"), mdx(\"p\", null, \"Great job! Now, you can develop using containers in a very convenient way! The next step is to put the code into production. This involves deploying your application so that it's accessible to end users.\"), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"./just-task-it-production\"\n  }, \"Proceed to the next step\")));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#goals","title":"Goals"},{"url":"#prerequisites","title":"Prerequisites"},{"url":"#1-docker-compose","title":"1. Docker Compose","items":[{"url":"#test-it","title":"Test it!"}]},{"url":"#next-step","title":"Next step"}]},"parent":{"relativePath":"vecka6-drift/just-task-it-docker-compose.md"},"frontmatter":{"metaTitle":"1dv613 | vecka 6 | JTI - Docker Compose","metaDescription":"metaDescription","fullWidth":null}},"allMdx":{"edges":[{"node":{"fields":{"slug":"/","title":"🎉 Välkommen till Mjukvaruutvecklingsprojekt (1DV613)"}}},{"node":{"fields":{"slug":"/video-loggar","title":"Videologgar"}}},{"node":{"fields":{"slug":"/studieguiden","title":"Studieguiden"}}},{"node":{"fields":{"slug":"/studieguiden/kommunikationsstrategi","title":"Kommunikationsstrategi"}}},{"node":{"fields":{"slug":"/studieguiden/kursledning","title":"Kursledning"}}},{"node":{"fields":{"slug":"/studieguiden/kursplan","title":"Kursplan och betyg"}}},{"node":{"fields":{"slug":"/studieguiden/litteratur","title":"Kurslitteratur"}}},{"node":{"fields":{"slug":"/studieguiden/schema","title":"Schema och deadlines"}}},{"node":{"fields":{"slug":"/studieguiden/studieanvisningar","title":"Studieanvisningar"}}},{"node":{"fields":{"slug":"/studieguiden/utvarderingar","title":"Kursvärderingar"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision/dokumentation","title":"Dokumentation"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision","title":"Vecka 1/2 - Planering och vision"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision/todo","title":"📅 Att göra-lista"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision/vision","title":"Projektvision"}}},{"node":{"fields":{"slug":"/vecka10-etik","title":"Vecka 10 - Etik & överlämning"}}},{"node":{"fields":{"slug":"/vecka10-etik/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka3-krav-test/arbeta-i-projekt","title":"Att arbeta i projekt"}}},{"node":{"fields":{"slug":"/vecka3-krav-test","title":"Vecka 3 - Krav och testning"}}},{"node":{"fields":{"slug":"/vecka3-krav-test/testning","title":"Testning"}}},{"node":{"fields":{"slug":"/vecka3-krav-test/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka3-krav-test/vecka3-krav-test","title":"Kravhantering"}}},{"node":{"fields":{"slug":"/vecka4-implementation/arkitektur","title":"Introduktion till mjukvaruarkitektur"}}},{"node":{"fields":{"slug":"/vecka4-implementation/docker-teori","title":"Introduktion till containers"}}},{"node":{"fields":{"slug":"/vecka4-implementation","title":"Vecka 4 - Implementation"}}},{"node":{"fields":{"slug":"/vecka4-implementation/just-task-it-docker","title":"Introduktion till Docker"}}},{"node":{"fields":{"slug":"/vecka4-implementation/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka5-versionshantering","title":"Vecka 5 - Versionshantering"}}},{"node":{"fields":{"slug":"/vecka5-versionshantering/jobba-med-git","title":"Jobba med Git"}}},{"node":{"fields":{"slug":"/vecka5-versionshantering/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka5-versionshantering/versionshantering","title":"Versionshantering"}}},{"node":{"fields":{"slug":"/vecka6-drift/docker-compose-teori","title":"Introduktion till Docker compose"}}},{"node":{"fields":{"slug":"/vecka6-drift","title":"Vecka 6 - Driftsättning"}}},{"node":{"fields":{"slug":"/vecka6-drift/just-task-it-docker-compose","title":"JTI - Docker Compose"}}},{"node":{"fields":{"slug":"/vecka6-drift/just-task-it-production","title":"JTI - Production"}}},{"node":{"fields":{"slug":"/vecka6-drift/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka7-ci-cd/ci-cd","title":"CI/CD"}}},{"node":{"fields":{"slug":"/vecka7-ci-cd","title":"Vecka 7 - CI/CD"}}},{"node":{"fields":{"slug":"/vecka7-ci-cd/just-task-it-deploy-pipeline","title":"JTI - Deploy through a pipeline"}}},{"node":{"fields":{"slug":"/vecka7-ci-cd/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka8-automatiska-test/automatiska-tester","title":"Automatiserad testning"}}},{"node":{"fields":{"slug":"/vecka8-automatiska-test","title":"Vecka 8 - Automatiserad testning"}}},{"node":{"fields":{"slug":"/vecka8-automatiska-test/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision/extern-updragsgivare","title":"Extern uppdragsgivare"}}},{"node":{"fields":{"slug":"/vecka9-leverans","title":"Vecka 9 - Slutleverans"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision/extern-updragsgivare/extern-uppdragsgivare-samverkan","title":"Samverkansinformation: studentprojekt med extern uppdragsgivare"}}},{"node":{"fields":{"slug":"/vecka9-leverans/todo","title":"Att göra lista"}}},{"node":{"fields":{"slug":"/vecka1-2-planering-vision/extern-updragsgivare/vagledning","title":"Vägledning för arbete med extern uppdragsgivare"}}}]}},"pageContext":{"id":"757a011f-e66d-51e4-9651-0a399a428f1f"}},
    "staticQueryHashes": ["253607798","3706406642","710574383"]}