diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php b/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php
index e851352..5fc7329 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php
@@ -68,7 +68,7 @@ public function routes() {
         case 'HEAD':
           // Restrict GET and HEAD requests to the media type specified in the
           // HTTP Accept headers.
-          $formats = drupal_container()->getParameter('serializer.formats');
+          $formats = \Drupal::service()->getParameter('serializer.formats');
           foreach ($formats as $format_name) {
             // Expose one route per available format.
             //$format_route = new Route($route->getPattern(), $route->getDefaults(), $route->getRequirements());
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php
index 694a422..0b1ea3f 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php
@@ -75,9 +75,8 @@ class RestExport extends PathPluginBase {
   public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
     parent::initDisplay($view, $display, $options);
 
-    $container = drupal_container();
-    $negotiation = $container->get('content_negotiation');
-    $request = $container->get('request');
+    $negotiation = \Drupal::service('content_negotiation');
+    $request = \Drupal::request();
 
     $request_content_type = $negotiation->getContentType($request);
     // Only use the requested content type if it's not 'html'. If it is then
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
index 42c2950..27453a5 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
    * Tests several valid and invalid create requests on all entity types.
    */
   public function testCreate() {
-    $serializer = drupal_container()->get('serializer');
+    $serializer = $this->container->get('serializer');
     // @todo once EntityNG is implemented for other entity types test all other
     // entity types here as well.
     $entity_type = 'entity_test';
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
index 4bad46b..860addf 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
@@ -200,7 +200,7 @@ protected function enableService($resource_type, $method = 'GET', $format = NULL
     $config->save();
 
     // Rebuild routing cache, so that the REST API paths are available.
-    drupal_container()->get('router.builder')->rebuild();
+    $this->container->get('router.builder')->rebuild();
     // Reset the Simpletest permission cache, so that the new resource
     // permissions get picked up.
     drupal_static_reset('checkPermissions');
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
index 25d56c9..18a1b82 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
    * Tests several valid and invalid partial update requests on test entities.
    */
   public function testPatchUpdate() {
-    $serializer = drupal_container()->get('serializer');
+    $serializer = $this->container->get('serializer');
     // @todo once EntityNG is implemented for other entity types test all other
     // entity types here as well.
     $entity_type = 'entity_test';
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
index 332310e..48bf955 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
@@ -109,7 +109,7 @@ public function testSerializerResponses() {
     $this->executeView($view);
 
     // Get the serializer service.
-    $serializer = drupal_container()->get('serializer');
+    $serializer = $this->container->get('serializer');
 
     $entities = array();
     foreach ($view->result as $row) {
diff --git a/core/modules/rest/rest.module b/core/modules/rest/rest.module
index 28b33cb..431ab7b 100644
--- a/core/modules/rest/rest.module
+++ b/core/modules/rest/rest.module
@@ -10,8 +10,8 @@
  */
 function rest_permission() {
   $permissions = array();
-  if (drupal_container()->has('plugin.manager.rest')) {
-    $manager = drupal_container()->get('plugin.manager.rest');
+  if (Drupal::service()->has('plugin.manager.rest')) {
+    $manager = Drupal::service('plugin.manager.rest');
     $resources = config('rest.settings')->get('resources');
     if ($resources && $enabled = array_intersect_key($manager->getDefinitions(), $resources)) {
       foreach ($enabled as $key => $resource) {
