|
| 1 | +# Usage Instructions |
| 2 | + |
| 3 | +## Preliminary Steps |
| 4 | + |
| 5 | +1. **Project Structure:** |
| 6 | + |
| 7 | + ``` |
| 8 | + llamator/ |
| 9 | + ├── docker/ |
| 10 | + │ ├── Dockerfile |
| 11 | + │ ├── jupyter_docker.sh |
| 12 | + │ └── README.md |
| 13 | + └── workspace/ |
| 14 | + └── (your working files) |
| 15 | + ``` |
| 16 | + |
| 17 | +2. **Creating Local `workspace` Directory:** |
| 18 | + |
| 19 | + If the local `./workspace` directory doesn't exist, it will be created automatically when the container starts. No need to create it manually. |
| 20 | + |
| 21 | +## Main Commands |
| 22 | + |
| 23 | +The `jupyter_docker.sh` script supports the following commands: |
| 24 | + |
| 25 | +1. **Building Docker Image:** |
| 26 | + |
| 27 | + Navigate to the `llamator/docker` directory and execute: |
| 28 | + |
| 29 | + ```bash |
| 30 | + ./jupyter_docker.sh build |
| 31 | + ``` |
| 32 | + |
| 33 | + This will create a Docker image named `jupyter_img` by default. Jupyter Notebook will run on port `9000` by default. |
| 34 | + |
| 35 | +2. **Running Container:** |
| 36 | + |
| 37 | + ```bash |
| 38 | + ./jupyter_docker.sh run [port] |
| 39 | + ``` |
| 40 | + |
| 41 | + - **Parameters:** |
| 42 | + - `[port]` *(optional)*: Port for accessing Jupyter Notebook. If not specified, port `9000` is used. |
| 43 | + |
| 44 | + - **Examples:** |
| 45 | + |
| 46 | + - Using default port: |
| 47 | + |
| 48 | + ```bash |
| 49 | + ./jupyter_docker.sh run |
| 50 | + ``` |
| 51 | + |
| 52 | + - Setting custom port, e.g., `8888`: |
| 53 | + |
| 54 | + ```bash |
| 55 | + ./jupyter_docker.sh run 8888 |
| 56 | + ``` |
| 57 | + |
| 58 | + - **Features:** |
| 59 | + - All arguments and settings are defined within the `jupyter_docker.sh` script. |
| 60 | + - When running the `run` command, you can specify a port as an argument that will be passed to the container. |
| 61 | + - If the local `./workspace` directory doesn't exist in the current directory, it will be created automatically. |
| 62 | + - If a container with the same name already exists, it will be stopped and removed before starting a new one. |
| 63 | + - The container will be launched in background mode. |
| 64 | + - The script will automatically extract the token and display the complete URL for accessing Jupyter Notebook, e.g.: `http://localhost:9000/?token=abc123def456ghi789jkl012mno345pqr678stu901vwx234yz`. |
| 65 | +
|
| 66 | +3. **Getting URL with Token:** |
| 67 | +
|
| 68 | + If you need to retrieve the URL with the current token again: |
| 69 | +
|
| 70 | + ```bash |
| 71 | + ./jupyter_docker.sh token |
| 72 | + ``` |
| 73 | +
|
| 74 | + You'll see output with a URL that can be opened in a browser to access Jupyter Notebook. |
| 75 | + |
| 76 | +4. **Adding New Packages via Poetry:** |
| 77 | + |
| 78 | + For example, to add the `numpy` package: |
| 79 | + |
| 80 | + ```bash |
| 81 | + ./jupyter_docker.sh add numpy |
| 82 | + ``` |
| 83 | + |
| 84 | +5. **Accessing Container's Bash Shell:** |
| 85 | +
|
| 86 | + If you need to execute commands inside the container: |
| 87 | +
|
| 88 | + ```bash |
| 89 | + ./jupyter_docker.sh bash |
| 90 | + ``` |
| 91 | +
|
| 92 | +6. **Stopping Container:** |
| 93 | +
|
| 94 | + To stop the running container: |
| 95 | +
|
| 96 | + ```bash |
| 97 | + ./jupyter_docker.sh stop |
| 98 | + ``` |
| 99 | +
|
| 100 | +7. **Removing Container:** |
| 101 | +
|
| 102 | + If you need to completely remove the container: |
| 103 | +
|
| 104 | + ```bash |
| 105 | + ./jupyter_docker.sh remove |
| 106 | + ``` |
| 107 | +
|
| 108 | +## Usage Examples |
| 109 | +
|
| 110 | +### 1. Build and Run with Default Port |
| 111 | +
|
| 112 | +```bash |
| 113 | +./jupyter_docker.sh build |
| 114 | +./jupyter_docker.sh run |
| 115 | +``` |
| 116 | +
|
| 117 | +- Jupyter Notebook will be accessible at: `http://localhost:9000/?token=your_token_here` |
| 118 | +
|
| 119 | +### 2. Build and Run with Custom Port |
| 120 | +
|
| 121 | +```bash |
| 122 | +./jupyter_docker.sh build |
| 123 | +./jupyter_docker.sh run 8888 |
| 124 | +``` |
| 125 | +
|
| 126 | +- Jupyter Notebook will be accessible at: `http://localhost:8888/?token=your_token_here` |
| 127 | +
|
| 128 | +### 3. Adding `pandas` Package |
| 129 | +
|
| 130 | +```bash |
| 131 | +./jupyter_docker.sh add pandas |
| 132 | +``` |
| 133 | +
|
| 134 | +- The `pandas` package will be installed and available in your project. |
0 commit comments