This study examines the use of dynamic programming in the context of container filling optimization, known as the knapsack problem. This problem requires selecting a number of goods with a certain volume and value to be loaded into a container with a certain capacity. We develop a knapsack-based algorithm using dynamic programming techniques to maximize container space utilization. By considering the volume and value of goods, our algorithm is able to achieve optimal results. Through a case study involving 25 items with predetermined volumes and values, we demonstrate the effectiveness of our algorithm in improving container space utilization. Our experimental results show significant improvements in container space utilization compared to naive filling methods. This research shows that the knapsack approach with dynamic programming can be an effective solution to the container filling problem in the context of logistics and optimization.