Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk9 min

How to Update a Docker Image and Recreate the Container

A practical guide to pulling newer Docker images, recreating Compose and plain Docker containers, avoiding the start-versus-up trap, and keeping persistent data safe.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Updating an image and updating a container are separate operations. For a Docker Compose service, pull the image that the file specifies, then run docker compose up so Compose can replace the old container. For a container created with docker run, pull the replacement image, remove the old container, and run a new one with the same options. Mounted volumes survive a Compose recreation; files stored only in a container’s writable layer do not survive container removal.

The correct update sequence at a glance

A running container keeps using the image from which it was created. Downloading a newer image does not retrofit that image into an existing container. The container must be recreated.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Situation Image operation Container operation What happens to data
Compose service using an image from a registry docker compose pull SERVICE docker compose up -d SERVICE Mounted volumes are preserved; the old container is replaced when the image or configuration changed.
Compose service built from a Dockerfile Build locally with --build docker compose up -d --build --force-recreate SERVICE Mounted volumes are preserved during recreation.
Plain docker run container docker pull IMAGE:TAG Stop, remove, and run a replacement with the original options. Named and bind mounts remain, but data only in the removed container’s writable layer is lost.

Use an explicit version tag or digest when the rollout must be reproducible. A tag such as latest can refer to different image content at different times.

Updating a Docker Compose service from a registry

1. Check the image reference in compose.yaml

Open the Compose file and identify the service you intend to update. Its image: value determines what Compose pulls. Change the tag when you want a specific release, or replace the tag with a digest when you need the exact image content to remain fixed.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
services:
  web:
    image: example/web:2.4

Changing the file is optional when the existing tag is mutable and you deliberately want whatever content the registry currently serves. It is required when moving from one version tag to another.

2. Pull the configured image

Run the pull for the service rather than relying on a previously cached image:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose pull SERVICE

Replace SERVICE with the service name under services, such as web. Compose contacts the configured registry and stores the image locally. Pulling alone does not alter the container that is already running.

3. Recreate and start the service

docker compose up -d SERVICE

Compose compares the existing container with the current service definition and image. If the image or service configuration changed after the container was created, it stops the old container and creates a replacement, preserving mounted volumes. Docker describes this behavior as: “If there are existing containers for a service, and the service’s configuration or image was changed after the container’s creation, docker compose up picks up the changes by stopping and recreating the containers (preserving mounted volumes).”

The -d option leaves the service running in the background. Without it, Compose attaches your terminal to the service output.

One command when you always want a fresh pull and replacement

docker compose up -d --pull always --force-recreate SERVICE

--pull always requests an image pull before starting. --force-recreate replaces the container even if Compose does not detect a change. This is useful for scheduled or scripted updates where you want the replacement policy to be explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If pulling on every run is unnecessary, use --pull missing or leave the pull policy at its default. The trade-off is that a cached image may be reused until Compose determines that a pull is needed.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Updating a service whose image is built locally

docker compose pull is for images obtained from a registry. A service with a build: section must be rebuilt from its Dockerfile before the replacement container starts.

docker compose up -d --build --force-recreate SERVICE

--build rebuilds the local image, while --force-recreate guarantees that the service container is replaced. Keep the service’s volume declarations unchanged when the rebuilt application must continue using the same database, uploads, or other persistent files.

If the Dockerfile or its build context did not change, Docker may reuse unchanged build layers. That is normal: the resulting image is still the one Compose starts. A registry pull and a local build are different paths; do not expect docker compose pull to rebuild a Dockerfile-based service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why docker compose start did not update anything

docker compose start only starts containers that already exist and are stopped. It does not pull images, create a replacement, or apply a changed image to an existing container.

The common unsuccessful sequence is:

docker compose pull SERVICE
docker compose start SERVICE

The pull downloads new image content, but start reuses the old container, which still references the image used at its creation. Use docker compose up -d SERVICE after the pull, or use the explicit --pull always --force-recreate command when both actions should be enforced.

Likewise, --no-recreate tells Compose not to replace an existing container. Remove that option when the purpose of the run is to apply a new image or changed configuration.

Keeping data safe during recreation

Mounted volumes survive a Compose replacement

Named volumes and bind mounts are outside the container’s writable layer. When Compose stops and recreates a service, those mounts are attached to the new container. This is the normal way to keep database files, uploaded media, configuration generated at runtime, and other durable state available after an image update.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Before updating, verify which paths are mounted in compose.yaml. A typical declaration makes the persistence boundary visible:

services:
  app:
    image: example/app:2.4
    volumes:
      - app-data:/var/lib/example
      - ./uploads:/srv/uploads

volumes:
  app-data:

The host directory in a bind mount and the named volume are retained when the container is replaced. The path inside the container must remain compatible with the new image; changing an application’s storage path without migrating files can still make existing data appear to be missing.

The writable layer is disposable

Every container has a writable layer for changes made inside the container that are not covered by a mount. Removing the container removes that layer. Docker’s Compose quickstart distinguishes the commands this way: docker compose stop preserves stopped containers, while docker compose down removes containers and data written only to the writable layer.

Do not treat the writable layer as a database, upload directory, or backup location. Move durable state to a named volume or bind mount, and verify a usable backup before replacement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A pre-update data checklist

  • Identify every database, upload, cache, and generated-file path used by the service.
  • Confirm each durable path is a named volume or bind mount, not an unmounted directory inside the container.
  • Check that the backup completed and can be read before stopping the old container.
  • Review release notes for schema migrations or incompatible storage changes before starting the new image.
  • Record the image tag or digest that is currently running so a rollback target is known.

Replacing a container created with docker run

Docker has no separate “update this container’s image” command for a container created directly with docker run. Create a replacement container instead.

1. Record the original run configuration

Before removing anything, capture the options that define how the application runs:

  • Image name, tag, or digest.
  • Published ports, such as -p 8080:80.
  • Environment variables and environment files.
  • Named volumes and bind mounts.
  • Networks and aliases.
  • Restart policy.
  • Linux capabilities, privilege settings, and other security options.
  • Entrypoint, command, working directory, user, and resource limits.

A replacement that omits one of these can start successfully while behaving differently from the original. Inspect the existing container and save its configuration before stopping it.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

2. Pull the replacement image

docker pull IMAGE:TAG

Use the exact image reference you selected. A digest is preferable when you need to ensure that a later pull resolves to the same content rather than whatever a mutable tag happens to reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Stop and remove the old container

docker stop CONTAINER
docker rm CONTAINER

docker stop gives the application an opportunity to shut down cleanly. docker rm removes the container object and its writable layer; it does not remove separately managed named volumes unless you explicitly request volume removal. Do not add a volume-removal option unless you have confirmed that the volume is disposable.

4. Run the replacement with the original options

docker run [the original options] IMAGE:TAG

Substitute the new tag or digest while carrying forward the ports, environment, mounts, networks, restart policy, capabilities, and command recorded earlier. If the application uses a bind mount or named volume, point the replacement at the same source so it sees the existing files.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing the update method

Decision axis Compose with registry image Compose with local build Plain docker run
Image source Registry; use docker compose pull. Dockerfile and build context; use --build. Registry pull with docker pull, followed by a new run.
Replacement policy up recreates when image or configuration changed; --force-recreate makes it unconditional. Rebuild and recreate with --build --force-recreate. Manual stop, remove, and run sequence.
Persistence model Mounted volumes are preserved during Compose recreation. Mounted volumes are preserved during Compose recreation. Mounts remain available to the replacement; the old writable layer is discarded.
Best fit Multi-container projects or services described in a Compose file. Applications whose image is produced by the project itself. Single containers managed without a Compose project.

Verifying that the new image is actually running

After recreation, verify the result rather than assuming a successful command means the application is healthy.

  1. List the service or container and confirm it is running.
  2. Check the service logs for startup errors, failed migrations, or an invalid configuration.
  3. Confirm the published port responds and that the application reports the expected version.
  4. Verify that the database, uploads, and other mounted data are visible to the new container.
  5. Record the image identifier or digest associated with the running container for deployment history.

For Compose projects, keep the project directory and the exact command used for the update. This makes it clear whether the service was pulled, rebuilt, or forcibly recreated.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rollback considerations

A rollback is another recreation, not an edit to the running container. Keep the previous tag or digest and restore that reference in the Compose file, or use it in the replacement docker run command. Then perform the same pull-or-build and recreate sequence.

Rolling back application code does not automatically reverse a database schema migration. Take backups before updates and check the image’s migration requirements so that a code rollback does not leave the data format incompatible with the older image.

Common mistakes and their fixes

Pulling but not recreating

Symptom: The pull reports a newer image, but the running application behaves exactly as before.
Fix: Run docker compose up -d SERVICE or recreate the plain Docker container. A pulled image is only a local image until a new container uses it.

Using start for an update

Symptom: docker compose start starts the old container.
Fix: Use up, which can stop and recreate a container when the image or service definition changed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Blocking replacement with --no-recreate

Symptom: Compose continues using the existing container despite a new image.
Fix: Remove --no-recreate. Add --force-recreate when you want replacement regardless of Compose’s change detection.

Forgetting --build

Symptom: A Dockerfile was edited, but the service still runs the prior locally built image.
Fix: Run docker compose up -d --build --force-recreate SERVICE.

Recreating a plain container with incomplete options

Symptom: The new container starts but has no published port, cannot reach its network, loses environment variables, or writes to the wrong directory.
Fix: Reconstruct the run command from the original container’s ports, environment, mounts, networks, restart policy, capabilities, and command before removing the old container.

Storing important files in the writable layer

Symptom: Data disappears after docker rm or a Compose replacement.
Fix: Put durable data in named or bind-mounted volumes and restore from a verified backup if the only copy was in the removed layer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A repeatable update checklist

  1. Identify whether the service is managed by Compose or plain docker run.
  2. Determine whether the image comes from a registry or a local Dockerfile.
  3. Choose an explicit release tag or digest when reproducibility matters.
  4. Confirm durable data is mounted and that a backup is available.
  5. For a registry-backed Compose service, run docker compose pull SERVICE, then docker compose up -d SERVICE.
  6. For a Dockerfile-backed Compose service, run docker compose up -d --build --force-recreate SERVICE.
  7. For a plain container, pull the image, stop and remove the old container, then run the replacement with every original option.
  8. Check logs, ports, health, application version, and mounted data.
  9. Record the image digest and keep the previous reference available for rollback.

The Bottom Line

Pulling an image downloads new bytes; recreating the container is what makes the running service use them. Use Compose’s up after a pull, use --build for Dockerfile services, and preserve important data in named or bind-mounted volumes rather than the container’s writable layer.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.