Skip to main content

Quickly Master Qwen3 in 5 minutes

Discover how to master Qwen3 in just 5 minutes! Click now for a quick, easy guide to boost your AI skills effortlessly.

Prerequisites​

  1. Install Docker

Step-by-Step Guide​

1. Launch Ollama Service​

docker run -d --name ollama --restart always -p 11434:11434 ollama/ollama
  • Key parameters:
    • -p 11434:11434: Exposes Ollama's API port 11434 as 11434 on your host
    • --restart always: Ensures automatic service recovery

2. Verify Container Status​

docker ps | grep ollama

You should see the ollama container with status "Up".

3. Run Qwen3 Model​

docker exec -it ollama ollama run qwen3:0.6b-q4_K_M
  • What happens:
    1. Auto-downloads ~500MB model file
    2. Enters interactive chat mode upon completion
    3. Type /exit or press Ctrl+D to quit

4. Basic Testing​

At the prompt, try:

Write a haiku about artificial intelligence

The model will respond with a proper 5-7-5 syllable poem:

<think>
Okay, the user wants a haiku about artificial intelligence. Let me start by recalling what a
haiku is. It has a three-line structure, typically with 5-7-5 syllables.

First, I need to incorporate AI elements. Let me think of some key aspects: algorithms, data,
maybe the future. Maybe start with the algorithm as the first line. "Algorithm whispers" adds
a bit of imagery.

Next, the second line. Maybe mention the data flow. "Data streams" could work. Then the third
line needs to tie it all together. Maybe something about the future or impact. "Future code"
sounds good. Let me check the syllables: 5, 7, 5. That fits.

Wait, "future code" and "future code" repeat. Oh, right, maybe there's a typo. Let me adjust
that to "future code" and then "future code" again. Or maybe "future's code". Hmm.
Alternatively, "future's code" as the third line. Let me rephrase the third line to make it
flow better. "Future's code" is 5 syllables. That works.

So the lines would be: "Algorithm whispers, data streams flow," then "future's code," and
"future's code." Wait, that's two lines with the same. Maybe the user wants each line to be
distinct. Let me try again. Maybe the second line is "data streams," and the third line is
"future's code." Then the first line is "Algorithm whispers, data streams flow." That makes
sense. So the final haiku would be as above.
</think>

Algorithm whispers, data streams flow,
future's code bends to the light.

Network Configuration Tip​

If you encounter network issues during model download (especially in restricted environments), consider using proxy solutions. For a streamlined Docker networking setup, we recommend checking out:
Docker + AutoFreeClash
This guide provides an efficient way to bypass network restrictions while maintaining Docker compatibility.

Container Management​

  • Stop service: docker stop ollama
  • Start service: docker restart ollama
  • Remove container: docker rm ollama

API Access​

Use the exposed port for programmatic access:

curl http://localhost:11434/api/generate -d '{
"model": "qwen3:0.6b-q4_K_M",
"prompt": "Explain blockchain in 10 words",
"stream": false
}'
{"model":"qwen3:0.6b-q4_K_M","created_at":"2025-04-30T04:41:50.849074299Z","response":"\u003cthink\u003e\nOkay, the user wants me to explain blockchain in 10 words. Let me start by recalling what blockchain is. It's a decentralized, distributed ledger technology. Now, how can I phrase that in 10 words without being too technical?\n\nFirst, \"Decentralized ledger technology.\" That's 8 words. Then, \"ensures secure and transparent transactions.\" That adds two more. Wait, but that's 10 words. Let me check: \"Decentralized ledger technology ensures secure and transparent transactions.\" Yes, that's exactly 10 words. It's concise and covers the key points: decentralization, ledger, security, transparency, transactions. I think that works. Let me make sure there are no other words needed. No, that's the limit. Alright, that should be it.\n\u003c/think\u003e\n\nDecentralized ledger technology ensures secure and transparent transactions.","done":true,"done_reason":"stop","context":[151644,872,198,840,20772,17944,304,220,16,15,4244,151645,198,151644,77091,198,151667,198,32313,11,279,1196,6801,752,311,10339,17944,304,220,16,15,4244,13,6771,752,1191,553,88646,1128,17944,374,13,1084,594,264,47963,11,4237,46933,5440,13,4695,11,1246,646,358,17133,429,304,220,16,15,4244,2041,1660,2238,10916,1939,5338,11,330,4900,45086,1506,46933,5440,1189,2938,594,220,23,4244,13,5005,11,330,724,1413,9767,323,17821,14131,1189,2938,11367,1378,803,13,13824,11,714,429,594,220,16,15,4244,13,6771,752,1779,25,330,4900,45086,1506,46933,5440,25351,9767,323,17821,14131,1189,7414,11,429,594,6896,220,16,15,4244,13,1084,594,63594,323,14521,279,1376,3501,25,38105,2022,11,46933,11,4763,11,27231,11,14131,13,358,1744,429,4278,13,6771,752,1281,2704,1052,525,902,1008,4244,4362,13,2308,11,429,594,279,3930,13,97593,11,429,1265,387,432,624,151668,271,4900,45086,1506,46933,5440,25351,9767,323,17821,14131,13],"total_duration":4967740127,"load_duration":39640458,"prompt_eval_count":16,"prompt_eval_duration":553877917,"eval_count":182,"eval_duration":4372863919}

Troubleshooting​

  1. Model download failures:

    • Check network connectivity
    • Retry with:
      docker exec -it ollama ollama run qwen3:0.6b-q4_K_M
  2. Chinese input issues:

    • Directly type Chinese prompts
    • Add instruction: "Respond in Chinese"

Notes:

  1. First run requires model download (time varies by network speed)
  2. The q4_K_M quantization balances performance and resource usage
  3. For production use, consider higher-precision model variants

Official resources:
Ollama Documentation | Qwen Models