title: how to solve ERRO[0000] error waiting for container: context canceled
body: <p>I am trying to test how to add user</p>
  <p>my docker info is:</p>
  <pre><code>% docker info
  Client:
   Context:    default
   Debug Mode: false
   Plugins:
    buildx: Docker Buildx (Docker Inc., v0.7.1)
    compose: Docker Compose (Docker Inc., v2.2.1)
    scan: Docker Scan (Docker Inc., 0.9.0)
  
  Server:
   Containers: 94
    Running: 0
    Paused: 0
    Stopped: 94
   Images: 11
   Server Version: 20.10.11
   Storage Driver: overlay2
    Backing Filesystem: extfs
    Supports d_type: true
    Native Overlay Diff: true
    userxattr: false
   Logging Driver: json-file
   Cgroup Driver: cgroupfs
   Cgroup Version: 2
   Plugins:
    Volume: local
    Network: bridge host ipvlan macvlan null overlay
    Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
   Swarm: inactive
   Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
   Default Runtime: runc
   Init Binary: docker-init
   containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
   runc version: v1.0.2-0-g52b36a2
   init version: de40ad0
   Security Options:
    seccomp
     Profile: default
    cgroupns
   Kernel Version: 5.10.76-linuxkit
   Operating System: Docker Desktop
   OSType: linux
   Architecture: aarch64
   CPUs: 4
   Total Memory: 1.942GiB
   Name: docker-desktop
   ID: BNVF:OFMF:5YJE:SAGF:CVBA:IOGG:36BQ:G63I:J6YM:KWFY:P5CL:EX3U
   Docker Root Dir: /var/lib/docker
   Debug Mode: true
    File Descriptors: 48
    Goroutines: 46
    System Time: 2022-01-16T15:49:03.553220221Z
    EventsListeners: 3
   HTTP Proxy: http.docker.internal:3128
   HTTPS Proxy: http.docker.internal:3128
   Registry: https://index.docker.io/v1/
   Labels:
   Experimental: true
   Insecure Registries:
    127.0.0.0/8
   Registry Mirrors:
    http://hub-mirror.c.163.com/
   Live Restore Enabled: false
  </code></pre>
  <p>my docker file is like:</p>
  <pre><code>FROM ubuntu:latest
  MAINTAINER xueshan
  RUN groupadd -r redis &amp;&amp; useradd -r -g redis redis
  USER redis
  CMD [&quot;redis-server&quot;]
  </code></pre>
  <pre><code>% docker build TEST -t testuser
  [+] Building 0.1s (6/6) FINISHED                                                                                                         
   =&gt; [internal] load build definition from Dockerfile                                                                                0.0s
   =&gt; =&gt; transferring dockerfile: 163B                                                                                                0.0s
   =&gt; [internal] load .dockerignore                                                                                                   0.0s
   =&gt; =&gt; transferring context: 2B                                                                                                     0.0s
   =&gt; [internal] load metadata for docker.io/library/ubuntu:latest                                                                    0.0s
   =&gt; [1/2] FROM docker.io/library/ubuntu:latest                                                                                      0.0s
   =&gt; CACHED [2/2] RUN groupadd -r redis &amp;&amp; useradd -r -g redis redis                                                                 0.0s
   =&gt; exporting to image                                                                                                              0.0s
   =&gt; =&gt; exporting layers                                                                                                             0.0s
   =&gt; =&gt; writing image sha256:74f15b450612cc59e37228be496e7c91f2f69b876073ec1803914932bd777eb2                                        0.0s
   =&gt; =&gt; naming to docker.io/library/testuser                                                                                         0.0s
  
  Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
  % docker run -it testuser
  docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: &quot;redis-server&quot;: executable file not found in $PATH: unknown.
  ERRO[0000] error waiting for container: context canceled 
  </code></pre>
  <p>from the output of buliding image, it seems that no error happened ...[?]
  I am wondering how to solve this problem and run docker with user <code>redis</code>
  or I have to add the path of this docker file as $path?</p>
  <p>and I tried with <code>docker ps</code></p>
  <pre><code>% docker ps
  CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
  </code></pre>
  <p>the result seems to show that no active container ... [?]</p>
  <p><strong>what I expect to see is that after successfully building the image, if I run it with <code>docker run -it 'image'</code>, the user at the terminal should change to <code>redis</code>.</strong></p>
  <p><em>2021/1/20 1st Update</em>
  <a href="https://i.stack.imgur.com/B71Fg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B71Fg.png" alt="docker file" /></a></p>
  <p><a href="https://i.stack.imgur.com/Bn656.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bn656.png" alt="building results" /></a></p>
  <p><em>2021/1/20 2nd Update</em>
  <a href="https://i.stack.imgur.com/La9HZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/La9HZ.png" alt="docker file" /></a></p>
  <p><a href="https://i.stack.imgur.com/Gi9tl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gi9tl.jpg" alt="building procedure" /></a></p>
  <p><em>2021/1/20 3rd Update</em></p>
  <p><a href="https://i.stack.imgur.com/sXVVy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sXVVy.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/xhlrQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xhlrQ.jpg" alt="enter image description here" /></a></p>
  <p><em>2021/1/20 4th Update</em>. <strong>this is what I expect to see</strong></p>
  <p><a href="https://i.stack.imgur.com/yq7GQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yq7GQ.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/nKWUj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nKWUj.png" alt="enter image description here" /></a></p>
  <br>
  reference: 
  <p><a href="https://dockerlabs.collabnix.com/beginners/dockerfile/user.html" rel="nofollow noreferrer">https://dockerlabs.collabnix.com/beginners/dockerfile/user.html</a>
  <a href="https://programming.vip/docs/detailed-explanation-of-docker-dockerfile-instructions-and-practical-cases.html" rel="nofollow noreferrer">https://programming.vip/docs/detailed-explanation-of-docker-dockerfile-instructions-and-practical-cases.html</a></p>