docker run container, how to rerun

I build container with:

docker build -f -t dave/xyz .

after that I run docker with:

  • Different results when pulling docker image from registry
  • debug docker deamon with gdb or cgdb
  • How to have login and access settings with a docker image registry
  • Openresty Hello world with docker
  • Running Vsts agent on nano server
  • Docker container in different HW architecture
  • docker run -it \
    --env='LDAP_USER=uid=bot_for_git,ou=bots,dc=company,dc=org' \
    --env='LDAP_PASS=' --volume=/srv/docker/xyz/data1:/data \
    -p 8010:8010 -p 9989:9989 dave/xyz

    and verified that’s all ok.

    what is next?

    My guess, that I should run docker ps, take container id from there, and to run container with the same preferences (environment, port mapping, volumes mapping) I should run:

    docker start -a container_id

    am I right?

    And what about rebuilding image, if change and rebuild dave/xyz, does container with container_id get
    update automatically, or I should repeat docker run -it step?

  • Node.js - Error: [unixODBC] on with Docker
  • Docker container apt-get install can't find package
  • Replace Docker container with external service
  • Docker compose scaling down and Consul
  • Docker images Ubuntu 14.04 not connected internet
  • Docker NLTK Download
  • One Solution collect form web for “docker run container, how to rerun”

    docker build [...] creates an image. You can see your images with docker images. You may give that image a specific name with the --tag=[...] option:

        docker build --tag="superuser/bestimage:latest" .

    docker run [...] <imageId> takes that image and starts a container. You can see active containers with docker ps (all with docker ps -a). If you used the tag above, docker run -it superuser/bestimage:latest may be used.

    When you rebuild an image, a new image with a new id is created. You may see that through docker images.

    does container with container_id get update automatically

    No. In order to update your container, you must first remove the container with docker kill <id> and then start a new one with docker run -it <newID>.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.