# How can I specify image name to spawner in pre\_spawn\_hook?

**URL:** <https://discourse.jupyter.org/t/how-can-i-specify-image-name-to-spawner-in-pre-spawn-hook/19239>\
**Category:** JupyterHub\
**Created:** [May 3, 2023, 12:26pm UTC](https://discourse.jupyter.org/t/how-can-i-specify-image-name-to-spawner-in-pre-spawn-hook/19239 "2023-05-03T12:26:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiveight58](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fiveight58/32/9657_2.png) [@fiveight58](https://discourse.jupyter.org/u/fiveight58)\
**Post date:** [May 3, 2023, 12:26pm UTC](https://discourse.jupyter.org/t/how-can-i-specify-image-name-to-spawner-in-pre-spawn-hook/19239/1 "2023-05-03T12:26:46Z")

</div>

Hi All:  
I have deploy jupyterhub with k8s and helm.  
I want to specify image name that jupyterhub used to create container. I have asked this for gpt-3, and he gave me code below:

```auto

 def specify_image(spawner):
     spawner.profile_list = []
     spawner.image = 'your_image_name'
 
 c.Spawner.pre_spawn_hook = specify_image

```

But I think these code can not work. Any help? Thanks.

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [May 5, 2023, 6:48pm UTC](https://discourse.jupyter.org/t/how-can-i-specify-image-name-to-spawner-in-pre-spawn-hook/19239/2 "2023-05-05T18:48:41Z")

</div>

You can specify the image name using `singleuser.image.name` and `singleuser.image.tag`:

> **[Customizing User Environment](https://z2jh.jupyter.org/en/stable/jupyterhub/customizing/user-environment.html#choose-and-use-an-existing-docker-image)**
>
> This page contains instructions for common ways to enhance the user experience. For a list of all the configurable Helm chart options, see the Configuration Reference. The user environment is the s...
