We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
launch_milvus() fails as milvus_dir != '/home/$USER/milvus/'
**Describe the bug**
launch_milvus() fails when `Path.home() ` is not same as `/home/$USER/milvus/`

milvus docker-compose.yml is stored inside Path.home()

```
  milvus_dir = Path.home() / "milvus"
 ......
  with open(milvus_dir / "docker-compose.yml", "wb") as f:
        f.write(request.content)
```

While docker compose is initiated using
```
status = subprocess.run(["cd /home/$USER/milvus/ && docker-compose up -d"], shell=True)
```

**Error message**
Error that was thrown (if available)
```
/bin/sh: line 0: cd: /home/bhoumis/milvus/: No such file or directory
WARNING - __main__ -  Tried to start Milvus through Docker but this failed. It is likely that there is already an existing Milvus instance running. 
```
**Expected behavior**
A clear and concise description of what you expected to happen.
```
status = subprocess.run([f"cd {milvus_dir} && docker-compose up -d"], shell=True)
```
**Additional context**
Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.

**To Reproduce**
Steps to reproduce the behavior
`
from haystack.utils import launch_milvus
launch_milvus()
`

**FAQ Check**
- [x] Have you had a look at [our new FAQ page](https://docs.haystack.deepset.ai/docs/faq)?

**System:**
 - OS: macOS Monterey v12.6.1
 - GPU/CPU: M1-Pro
 - Haystack version (commit or version number):  v1.12.2
 - DocumentStore: MilvusDocumentStore(
 - Reader: NA
 - Retriever: NA


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `haystack/utils/doc_store.py`
Content:
```
1 # pylint: disable=missing-timeout
2 
3 import time
4 import logging
5 import subprocess
6 from pathlib import Path
7 
8 import requests
9 
10 
11 logger = logging.getLogger(__name__)
12 ELASTICSEARCH_CONTAINER_NAME = "elasticsearch"
13 OPENSEARCH_CONTAINER_NAME = "opensearch"
14 WEAVIATE_CONTAINER_NAME = "weaviate"
15 
16 
17 def launch_es(sleep=15, delete_existing=False):
18     """
19     Start an Elasticsearch server via Docker.
20     """
21 
22     logger.debug("Starting Elasticsearch ...")
23     if delete_existing:
24         _ = subprocess.run([f"docker rm --force {ELASTICSEARCH_CONTAINER_NAME}"], shell=True, stdout=subprocess.DEVNULL)
25     status = subprocess.run(
26         [
27             f'docker start {ELASTICSEARCH_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p 9200:9200 -e "discovery.type=single-node" --name {ELASTICSEARCH_CONTAINER_NAME} elasticsearch:7.9.2'
28         ],
29         shell=True,
30     )
31     if status.returncode:
32         logger.warning(
33             "Tried to start Elasticsearch through Docker but this failed. "
34             "It is likely that there is already an existing Elasticsearch instance running. "
35         )
36     else:
37         time.sleep(sleep)
38 
39 
40 def launch_opensearch(sleep=15, delete_existing=False, local_port=9200):
41     """
42     Start an OpenSearch server via Docker.
43     """
44     logger.debug("Starting OpenSearch...")
45     # This line is needed since it is not possible to start a new docker container with the name opensearch if there is a stopped image with the same now
46     # docker rm only succeeds if the container is stopped, not if it is running
47     if delete_existing:
48         _ = subprocess.run([f"docker rm --force {OPENSEARCH_CONTAINER_NAME}"], shell=True, stdout=subprocess.DEVNULL)
49     status = subprocess.run(
50         [
51             f'docker start {OPENSEARCH_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p {local_port}:9200 -p 9600:9600 -e "discovery.type=single-node" --name {OPENSEARCH_CONTAINER_NAME} opensearchproject/opensearch:1.3.5'
52         ],
53         shell=True,
54     )
55     if status.returncode:
56         logger.warning(
57             "Tried to start OpenSearch through Docker but this failed. "
58             "It is likely that there is already an existing OpenSearch instance running. "
59         )
60     else:
61         time.sleep(sleep)
62 
63 
64 def launch_weaviate(sleep=15):
65     """
66     Start a Weaviate server via Docker.
67     """
68 
69     logger.debug("Starting Weaviate ...")
70     status = subprocess.run(
71         [
72             f"docker start {WEAVIATE_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p 8080:8080 --env AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED='true' --env PERSISTENCE_DATA_PATH='/var/lib/weaviate' --name {WEAVIATE_CONTAINER_NAME} semitechnologies/weaviate:latest"
73         ],
74         shell=True,
75     )
76     if status.returncode:
77         logger.warning(
78             "Tried to start Weaviate through Docker but this failed. "
79             "It is likely that there is already an existing Weaviate instance running. "
80         )
81     else:
82         time.sleep(sleep)
83 
84 
85 def stop_container(container_name, delete_container=False):
86     logger.debug("Stopping %s...", container_name)
87     status = subprocess.run([f"docker stop {container_name}"], shell=True)
88     if status.returncode:
89         logger.warning(
90             f"Tried to stop {container_name} but this failed. "
91             f"It is likely that there was no Docker container with the name {container_name}"
92         )
93     if delete_container:
94         status = subprocess.run([f"docker rm {container_name}"], shell=True)
95 
96 
97 def stop_opensearch(delete_container=False):
98     stop_container(OPENSEARCH_CONTAINER_NAME, delete_container)
99 
100 
101 def stop_elasticsearch(delete_container=False):
102     stop_container(ELASTICSEARCH_CONTAINER_NAME, delete_container)
103 
104 
105 def stop_weaviate(delete_container=False):
106     stop_container(WEAVIATE_CONTAINER_NAME, delete_container)
107 
108 
109 def stop_service(document_store, delete_container=False):
110     ds_class = str(type(document_store))
111     if "OpenSearchDocumentStore" in ds_class:
112         stop_opensearch(delete_container)
113     elif "ElasticsearchDocumentStore" in ds_class:
114         stop_elasticsearch(delete_container)
115     elif "WeaviateDocumentStore" in ds_class:
116         stop_weaviate(delete_container)
117     else:
118         logger.warning("No support yet for auto stopping the service behind a %s", type(document_store))
119 
120 
121 def launch_milvus(sleep=15, delete_existing=False):
122     """
123     Start a Milvus server via Docker
124     """
125     logger.debug("Starting Milvus ...")
126 
127     milvus_dir = Path.home() / "milvus"
128     milvus_dir.mkdir(exist_ok=True)
129 
130     request = requests.get(
131         "https://github.com/milvus-io/milvus/releases/download/v2.0.0/milvus-standalone-docker-compose.yml"
132     )
133     with open(milvus_dir / "docker-compose.yml", "wb") as f:
134         f.write(request.content)
135 
136     status = subprocess.run(["cd /home/$USER/milvus/ && docker-compose up -d"], shell=True)
137 
138     if status.returncode:
139         logger.warning(
140             "Tried to start Milvus through Docker but this failed. "
141             "It is likely that there is already an existing Milvus instance running. "
142         )
143     else:
144         time.sleep(sleep)
145
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/haystack/utils/doc_store.py b/haystack/utils/doc_store.py
--- a/haystack/utils/doc_store.py
+++ b/haystack/utils/doc_store.py
@@ -133,7 +133,7 @@
     with open(milvus_dir / "docker-compose.yml", "wb") as f:
         f.write(request.content)
 
-    status = subprocess.run(["cd /home/$USER/milvus/ && docker-compose up -d"], shell=True)
+    status = subprocess.run([f"cd {milvus_dir} && docker-compose up -d"], shell=True)
 
     if status.returncode:
         logger.warning(

{"golden_diff": "diff --git a/haystack/utils/doc_store.py b/haystack/utils/doc_store.py\n--- a/haystack/utils/doc_store.py\n+++ b/haystack/utils/doc_store.py\n@@ -133,7 +133,7 @@\n     with open(milvus_dir / \"docker-compose.yml\", \"wb\") as f:\n         f.write(request.content)\n \n-    status = subprocess.run([\"cd /home/$USER/milvus/ && docker-compose up -d\"], shell=True)\n+    status = subprocess.run([f\"cd {milvus_dir} && docker-compose up -d\"], shell=True)\n \n     if status.returncode:\n         logger.warning(\n", "issue": "launch_milvus() fails as milvus_dir != '/home/$USER/milvus/'\n**Describe the bug**\r\nlaunch_milvus() fails when `Path.home() ` is not same as `/home/$USER/milvus/`\r\n\r\nmilvus docker-compose.yml is stored inside Path.home()\r\n\r\n```\r\n  milvus_dir = Path.home() / \"milvus\"\r\n ......\r\n  with open(milvus_dir / \"docker-compose.yml\", \"wb\") as f:\r\n        f.write(request.content)\r\n```\r\n\r\nWhile docker compose is initiated using\r\n```\r\nstatus = subprocess.run([\"cd /home/$USER/milvus/ && docker-compose up -d\"], shell=True)\r\n```\r\n\r\n**Error message**\r\nError that was thrown (if available)\r\n```\r\n/bin/sh: line 0: cd: /home/bhoumis/milvus/: No such file or directory\r\nWARNING - __main__ -  Tried to start Milvus through Docker but this failed. It is likely that there is already an existing Milvus instance running. \r\n```\r\n**Expected behavior**\r\nA clear and concise description of what you expected to happen.\r\n```\r\nstatus = subprocess.run([f\"cd {milvus_dir} && docker-compose up -d\"], shell=True)\r\n```\r\n**Additional context**\r\nAdd any other context about the problem here, like document types / preprocessing steps / settings of reader etc.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior\r\n`\r\nfrom haystack.utils import launch_milvus\r\nlaunch_milvus()\r\n`\r\n\r\n**FAQ Check**\r\n- [x] Have you had a look at [our new FAQ page](https://docs.haystack.deepset.ai/docs/faq)?\r\n\r\n**System:**\r\n - OS: macOS Monterey v12.6.1\r\n - GPU/CPU: M1-Pro\r\n - Haystack version (commit or version number):  v1.12.2\r\n - DocumentStore: MilvusDocumentStore(\r\n - Reader: NA\r\n - Retriever: NA\r\n\n", "before_files": [{"content": "# pylint: disable=missing-timeout\n\nimport time\nimport logging\nimport subprocess\nfrom pathlib import Path\n\nimport requests\n\n\nlogger = logging.getLogger(__name__)\nELASTICSEARCH_CONTAINER_NAME = \"elasticsearch\"\nOPENSEARCH_CONTAINER_NAME = \"opensearch\"\nWEAVIATE_CONTAINER_NAME = \"weaviate\"\n\n\ndef launch_es(sleep=15, delete_existing=False):\n    \"\"\"\n    Start an Elasticsearch server via Docker.\n    \"\"\"\n\n    logger.debug(\"Starting Elasticsearch ...\")\n    if delete_existing:\n        _ = subprocess.run([f\"docker rm --force {ELASTICSEARCH_CONTAINER_NAME}\"], shell=True, stdout=subprocess.DEVNULL)\n    status = subprocess.run(\n        [\n            f'docker start {ELASTICSEARCH_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p 9200:9200 -e \"discovery.type=single-node\" --name {ELASTICSEARCH_CONTAINER_NAME} elasticsearch:7.9.2'\n        ],\n        shell=True,\n    )\n    if status.returncode:\n        logger.warning(\n            \"Tried to start Elasticsearch through Docker but this failed. \"\n            \"It is likely that there is already an existing Elasticsearch instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n\n\ndef launch_opensearch(sleep=15, delete_existing=False, local_port=9200):\n    \"\"\"\n    Start an OpenSearch server via Docker.\n    \"\"\"\n    logger.debug(\"Starting OpenSearch...\")\n    # This line is needed since it is not possible to start a new docker container with the name opensearch if there is a stopped image with the same now\n    # docker rm only succeeds if the container is stopped, not if it is running\n    if delete_existing:\n        _ = subprocess.run([f\"docker rm --force {OPENSEARCH_CONTAINER_NAME}\"], shell=True, stdout=subprocess.DEVNULL)\n    status = subprocess.run(\n        [\n            f'docker start {OPENSEARCH_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p {local_port}:9200 -p 9600:9600 -e \"discovery.type=single-node\" --name {OPENSEARCH_CONTAINER_NAME} opensearchproject/opensearch:1.3.5'\n        ],\n        shell=True,\n    )\n    if status.returncode:\n        logger.warning(\n            \"Tried to start OpenSearch through Docker but this failed. \"\n            \"It is likely that there is already an existing OpenSearch instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n\n\ndef launch_weaviate(sleep=15):\n    \"\"\"\n    Start a Weaviate server via Docker.\n    \"\"\"\n\n    logger.debug(\"Starting Weaviate ...\")\n    status = subprocess.run(\n        [\n            f\"docker start {WEAVIATE_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p 8080:8080 --env AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED='true' --env PERSISTENCE_DATA_PATH='/var/lib/weaviate' --name {WEAVIATE_CONTAINER_NAME} semitechnologies/weaviate:latest\"\n        ],\n        shell=True,\n    )\n    if status.returncode:\n        logger.warning(\n            \"Tried to start Weaviate through Docker but this failed. \"\n            \"It is likely that there is already an existing Weaviate instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n\n\ndef stop_container(container_name, delete_container=False):\n    logger.debug(\"Stopping %s...\", container_name)\n    status = subprocess.run([f\"docker stop {container_name}\"], shell=True)\n    if status.returncode:\n        logger.warning(\n            f\"Tried to stop {container_name} but this failed. \"\n            f\"It is likely that there was no Docker container with the name {container_name}\"\n        )\n    if delete_container:\n        status = subprocess.run([f\"docker rm {container_name}\"], shell=True)\n\n\ndef stop_opensearch(delete_container=False):\n    stop_container(OPENSEARCH_CONTAINER_NAME, delete_container)\n\n\ndef stop_elasticsearch(delete_container=False):\n    stop_container(ELASTICSEARCH_CONTAINER_NAME, delete_container)\n\n\ndef stop_weaviate(delete_container=False):\n    stop_container(WEAVIATE_CONTAINER_NAME, delete_container)\n\n\ndef stop_service(document_store, delete_container=False):\n    ds_class = str(type(document_store))\n    if \"OpenSearchDocumentStore\" in ds_class:\n        stop_opensearch(delete_container)\n    elif \"ElasticsearchDocumentStore\" in ds_class:\n        stop_elasticsearch(delete_container)\n    elif \"WeaviateDocumentStore\" in ds_class:\n        stop_weaviate(delete_container)\n    else:\n        logger.warning(\"No support yet for auto stopping the service behind a %s\", type(document_store))\n\n\ndef launch_milvus(sleep=15, delete_existing=False):\n    \"\"\"\n    Start a Milvus server via Docker\n    \"\"\"\n    logger.debug(\"Starting Milvus ...\")\n\n    milvus_dir = Path.home() / \"milvus\"\n    milvus_dir.mkdir(exist_ok=True)\n\n    request = requests.get(\n        \"https://github.com/milvus-io/milvus/releases/download/v2.0.0/milvus-standalone-docker-compose.yml\"\n    )\n    with open(milvus_dir / \"docker-compose.yml\", \"wb\") as f:\n        f.write(request.content)\n\n    status = subprocess.run([\"cd /home/$USER/milvus/ && docker-compose up -d\"], shell=True)\n\n    if status.returncode:\n        logger.warning(\n            \"Tried to start Milvus through Docker but this failed. \"\n            \"It is likely that there is already an existing Milvus instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n", "path": "haystack/utils/doc_store.py"}], "after_files": [{"content": "# pylint: disable=missing-timeout\n\nimport time\nimport logging\nimport subprocess\nfrom pathlib import Path\n\nimport requests\n\n\nlogger = logging.getLogger(__name__)\nELASTICSEARCH_CONTAINER_NAME = \"elasticsearch\"\nOPENSEARCH_CONTAINER_NAME = \"opensearch\"\nWEAVIATE_CONTAINER_NAME = \"weaviate\"\n\n\ndef launch_es(sleep=15, delete_existing=False):\n    \"\"\"\n    Start an Elasticsearch server via Docker.\n    \"\"\"\n\n    logger.debug(\"Starting Elasticsearch ...\")\n    if delete_existing:\n        _ = subprocess.run([f\"docker rm --force {ELASTICSEARCH_CONTAINER_NAME}\"], shell=True, stdout=subprocess.DEVNULL)\n    status = subprocess.run(\n        [\n            f'docker start {ELASTICSEARCH_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p 9200:9200 -e \"discovery.type=single-node\" --name {ELASTICSEARCH_CONTAINER_NAME} elasticsearch:7.9.2'\n        ],\n        shell=True,\n    )\n    if status.returncode:\n        logger.warning(\n            \"Tried to start Elasticsearch through Docker but this failed. \"\n            \"It is likely that there is already an existing Elasticsearch instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n\n\ndef launch_opensearch(sleep=15, delete_existing=False, local_port=9200):\n    \"\"\"\n    Start an OpenSearch server via Docker.\n    \"\"\"\n    logger.debug(\"Starting OpenSearch...\")\n    # This line is needed since it is not possible to start a new docker container with the name opensearch if there is a stopped image with the same now\n    # docker rm only succeeds if the container is stopped, not if it is running\n    if delete_existing:\n        _ = subprocess.run([f\"docker rm --force {OPENSEARCH_CONTAINER_NAME}\"], shell=True, stdout=subprocess.DEVNULL)\n    status = subprocess.run(\n        [\n            f'docker start {OPENSEARCH_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p {local_port}:9200 -p 9600:9600 -e \"discovery.type=single-node\" --name {OPENSEARCH_CONTAINER_NAME} opensearchproject/opensearch:1.3.5'\n        ],\n        shell=True,\n    )\n    if status.returncode:\n        logger.warning(\n            \"Tried to start OpenSearch through Docker but this failed. \"\n            \"It is likely that there is already an existing OpenSearch instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n\n\ndef launch_weaviate(sleep=15):\n    \"\"\"\n    Start a Weaviate server via Docker.\n    \"\"\"\n\n    logger.debug(\"Starting Weaviate ...\")\n    status = subprocess.run(\n        [\n            f\"docker start {WEAVIATE_CONTAINER_NAME} > /dev/null 2>&1 || docker run -d -p 8080:8080 --env AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED='true' --env PERSISTENCE_DATA_PATH='/var/lib/weaviate' --name {WEAVIATE_CONTAINER_NAME} semitechnologies/weaviate:latest\"\n        ],\n        shell=True,\n    )\n    if status.returncode:\n        logger.warning(\n            \"Tried to start Weaviate through Docker but this failed. \"\n            \"It is likely that there is already an existing Weaviate instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n\n\ndef stop_container(container_name, delete_container=False):\n    logger.debug(\"Stopping %s...\", container_name)\n    status = subprocess.run([f\"docker stop {container_name}\"], shell=True)\n    if status.returncode:\n        logger.warning(\n            f\"Tried to stop {container_name} but this failed. \"\n            f\"It is likely that there was no Docker container with the name {container_name}\"\n        )\n    if delete_container:\n        status = subprocess.run([f\"docker rm {container_name}\"], shell=True)\n\n\ndef stop_opensearch(delete_container=False):\n    stop_container(OPENSEARCH_CONTAINER_NAME, delete_container)\n\n\ndef stop_elasticsearch(delete_container=False):\n    stop_container(ELASTICSEARCH_CONTAINER_NAME, delete_container)\n\n\ndef stop_weaviate(delete_container=False):\n    stop_container(WEAVIATE_CONTAINER_NAME, delete_container)\n\n\ndef stop_service(document_store, delete_container=False):\n    ds_class = str(type(document_store))\n    if \"OpenSearchDocumentStore\" in ds_class:\n        stop_opensearch(delete_container)\n    elif \"ElasticsearchDocumentStore\" in ds_class:\n        stop_elasticsearch(delete_container)\n    elif \"WeaviateDocumentStore\" in ds_class:\n        stop_weaviate(delete_container)\n    else:\n        logger.warning(\"No support yet for auto stopping the service behind a %s\", type(document_store))\n\n\ndef launch_milvus(sleep=15, delete_existing=False):\n    \"\"\"\n    Start a Milvus server via Docker\n    \"\"\"\n    logger.debug(\"Starting Milvus ...\")\n\n    milvus_dir = Path.home() / \"milvus\"\n    milvus_dir.mkdir(exist_ok=True)\n\n    request = requests.get(\n        \"https://github.com/milvus-io/milvus/releases/download/v2.0.0/milvus-standalone-docker-compose.yml\"\n    )\n    with open(milvus_dir / \"docker-compose.yml\", \"wb\") as f:\n        f.write(request.content)\n\n    status = subprocess.run([f\"cd {milvus_dir} && docker-compose up -d\"], shell=True)\n\n    if status.returncode:\n        logger.warning(\n            \"Tried to start Milvus through Docker but this failed. \"\n            \"It is likely that there is already an existing Milvus instance running. \"\n        )\n    else:\n        time.sleep(sleep)\n", "path": "haystack/utils/doc_store.py"}]}