Important Update: Changes to Docker Compose Deployment Behavior in Okteto

Dear Okteto Community,

We’re writing to announce an important adjustment to a feature within Okteto that affects the deployment of Docker Compose files onto Kubernetes clusters.

Starting with upcoming Okteto CLI 2.26.1 and Okteto helm chart 1.19.1, Host volumes will be ignored at deployment time for Docker Compose services defining a build section. Instead, Okteto will use the image generated by the build section of the service without further modifications. This change eliminates redundant builds and will make the deployment process more intuitive and easier for new users to understand.

How to Check if Your Docker Compose File is Affected

You can review your Docker Compose file(s) and look for Host Volumes mounting files from local to the container. If present, your Docker Compose file may be affected by this change. It’s important to note that user-defined named volumes, such as those defined in the top-level volumes section, are not impacted by this change and can continue to be used as usual.

If one of your services is using Host Volumes and defines a build section, it would be affected by this change. For example, the following service is affected:

services:
  nginx:
    build: .
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf # File mounted into container
      - ./static:/var/www/static # Folder mounted into container

How to Mimic the Previous Behavior

To replicate Okteto’s previous behavior, you will need to modify your current Dockerfile to make sure your Docker image includes any local content you want to make available in the container. This can be achieved by adding the necessary COPY commands to your Dockerfile:

FROM nginx:latest

# Copy the necessary files and folder
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./static /var/www/static

By following these steps, you have control over the content that is available in your containers and keep your deployment process consistent with the previous behavior.

We understand that changes like these may require some adjustments to your workflows, and we’re here to support you every step of the way. If you have any questions or need assistance with transitioning to the new deployment method, please don’t hesitate to reach out to our support team.

Thank you for your understanding and continued support as we strive to enhance the Okteto experience for all users.

Best regards

1 Like