docker run container, how to rerun

I build container with:

docker build -f -t dave/xyz .

after that I run docker with:

  • “I have no name!” as user logging into Jenkins in a docker container that uses Tini
  • Hibernate database configuration for cloud deployment
  • Old Gradle version installed in docker container
  • Unable to run docker commands after new docker installation
  • How i eexec gobblin with Docker
  • Cannot finde module 'express' (node app with docker)
  • 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?

  • Docker build takes too long
  • Docker service Limits and Reservations
  • How does one remove an image in Docker?
  • Add and delete links to a docker container dynamically
  • Docker with ElasticSearch none-root permission issue
  • Communication between variable number of Docker containers
  • 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.