`Dockerfile`, create a new file named `compose.yaml`.
Open the `compose.yaml` file in an IDE or text editor and add the following
contents.
```yaml
services:
jupyter:
build:
context: .
ports:
- 8889:8888
volumes:
- jupyter-data:/home/jovyan/work
command: start-notebook.py --NotebookApp.token='my-token'
volumes:
jupyter-data:
name: jupyter-data
```
This Compose file specifies all the options you used in the `docker run` command. For more details about the Compose instructions, see the
[Compose file reference](/reference/compose-file/_index.md).
Before you proceed, save your changes to the `compose.yaml` file.
### Run your container using Compose
Open a terminal, change directory to where your `compose.yaml` file is located, and then run the following command.
```console
$ docker compose up --build
```
This command builds your image and runs it as a container using the instructions
specified in the `compose.yaml` file. The `--build` option ensures that your
image is rebuilt, which is necessary if you made changes to your `Dockerfile`.
To access the container, in a web browser navigate to
[localhost:8889/lab?token=my-token](http://localhost:8889/lab?token=my-token).
In the terminal, press `ctrl`+ `c` to stop the container.
## Share your work
By sharing your image and notebook, you create a portable and replicable
research environment that can be easily accessed and used by other data
scientists. This process not only facilitates collaboration but also ensures
that your work is preserved in an environment where it can be run without
compatibility issues.
To share your image and data, you'll use [Docker Hub](https://hub.docker.com/). Docker Hub is a cloud-based registry service that lets you share and distribute container images.
### Share your image
1. [Sign up](https://www.docker.com/pricing?utm_source=docker&utm_medium=webreferral&utm_campaign=docs_driven_upgrade) or sign in to [Docker Hub](https://hub.docker.com).
2. Rename your image so that Docker knows which repository to push it to. Open a
terminal and run the following `docker tag` command. Replace `YOUR-USER-NAME`
with your Docker ID.
```console
$ docker tag my-jupyter-image YOUR-USER-NAME/my-jupyter-image
```
3. Run the following `docker push` command to push the image to Docker Hub.
Replace `YOUR-USER-NAME` with your Docker ID.
```console
$ docker push YOUR-USER-NAME/my-jupyter-image
```
4. Verify that you pushed the image to Docker Hub.
1. Go to [Docker Hub](https://hub.docker.com).
2. Select **My Hub** > **Repositories**.
3. View the **Last pushed** time for your repository.
Other users can now download and run your image using the `docker run` command. They need to replace `YOUR-USER-NAME` with your Docker ID.